<!DOCTYPE html>

<html lang="en">
<head>
  <!-- Required meta tags -->
  <meta charset="utf-8">
  <meta http-equiv="x-ua-compatible" content="ie=edge">
  <meta name="viewport"
        content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
  <meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
  <meta name="baidu-site-verification" content="GOgEP8c1pN"/>
  

  <title>
    真正的 Django 博客首页视图_Django博客教程_追梦人物的博客</title>

  <link href="font-awesome.min.css"
        rel="stylesheet">
  <link rel="stylesheet" href="mobi.min.css">
  <link rel="stylesheet" href="modal.min.css">
  <link rel="stylesheet" href="friendly.css">
  <link rel="stylesheet" href="blog.css?v0.12">
  <script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
  <script src="/static/blog/js/menu.js"></script>
  <script src="/static/blog/js/modal.min.js"></script>
  <script src="/static/blog/js/blog.js"></script>
  

  
    <script>
        // baidu statistics
        var _hmt = _hmt || [];
        (function () {
            var hm = document.createElement("script");
            hm.src = "https://hm.baidu.com/hm.js?fb59b2a6022bccc02671a750f61c356b";
            var s = document.getElementsByTagName("script")[0];
            s.parentNode.insertBefore(hm, s);
        })();

        // baidu auto push
        (function () {
            var bp = document.createElement('script');
            var curProtocol = window.location.protocol.split(':')[0];
            if (curProtocol === 'https') {
                bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
            }
            else {
                bp.src = 'http://push.zhanzhang.baidu.com/push.js';
            }
            var s = document.getElementsByTagName("script")[0];
            s.parentNode.insertBefore(bp, s);
        })();
    </script>
    
  
</head>
<body class="bg-light">
<header>
  <nav class="flex-center bg-white nav-bar">
    <div class="container-wider flex-middle">
      
  <a class="show-on-mobile nav-link m-5" id="js-sidebar-btn" href="#" role="button">
    <i class="fa fa-chevron-right" aria-hidden="true"></i>
  </a>

      <a class="nav-bar-logo mr-7" href="/">
        <img src="/static/blog/images/logo.png" alt="blog logo">
      </a>
      <ul class="unit-0 hide-on-mobile nav-bar-nav">
        <li class="nav-item mr-7">
          <a class="nav-link" href="/">首页</a>
        </li>
        <li class="nav-item mr-7">
          <a class="nav-link" href="/tutorials/">教程</a>
        </li>
        <li class="nav-item mr-7">
          <a class="nav-link" href="/categories/">分类</a>
        </li>
        <li class="nav-item mr-7">
          <a class="nav-link" href="/archives/">归档</a>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="/donate/">赞助</a>
        </li>
      </ul>
      <div class="unit flex-right flex-middle">
        <form class="hide-on-mobile flex-left flex-middle search-form mr-5" id="search-form"
              action="/search/">
          <input class="unit" type="search" name="q" placeholder="搜索..."/>
          <button class="unit-0" type="submit" role="button">
            <i class="fa fa-search" aria-hidden="true"></i>
          </button>
        </form>
        <a class="show-on-mobile nav-link fs-7 mr-7" id="js-search-btn" href="#" role="button">
          <i class="fa fa-search" aria-hidden="true"></i>
        </a>
        <div class="flex-middle notification">
          
            <a class="nav-link" href="/accounts/login/">
              <i class="fa fa-sign-in" aria-hidden="true"></i>
            </a>
          
        </div>
        <div class="show-on-mobile flex-middle">
          <a class="nav-link fs-7 ml-7 mr-5" id="menu-toggle" href="#">
            <i class="fa fa-ellipsis-v" aria-hidden="true"></i>
          </a>
          <ul class="menu bg-white" data-menu data-menu-toggle="#menu-toggle">
            <li class="nav-item mr-7">
              <a class="nav-link" href="/">首页</a>
            </li>
            <li>
              <a href="/tutorials/">教程</a>
            </li>
            <li>
              <a href="/categories/">分类</a>
            </li>
            <li>
              <a href="/archives/">归档</a>
            </li>
            <li>
              <a href="/donate/">赞助</a>
            </li>
          </ul>
        </div>
      </div>
    </div>
  </nav>
</header>
<section class="flex-center">
  <div class="container-wider">
    <!-- 模态框（Modal） -->
    <div class="modal fade" id="myModal" tabindex="-1" role="dialog"
         aria-labelledby="myModalLabel" aria-hidden="true">
      <div class="modal-dialog">
        <div class="modal-content">
          <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
              &times;
            </button>
            <h4 class="modal-title" id="myModalLabel">设置评论回复接收邮箱</h4>
            <div class="text-primary mt-2">邮箱仅用于接收回复提醒，不会被公开。</div>
            
          </div>
          <div class="modal-body">
            <form class="form email-binding-form" action="/comments/ajax_email_binding/">
              <div class="message">
                <span class="text-danger"></span>
              </div>
              <input type='hidden' name='csrfmiddlewaretoken' value='U7jPbglKkTawKKhhqLGlh1DiJ1gwnr5VVS9DFRGwEQJQY38UL7KKyXFj528sVlI8' />
              <div class="flex-left units-gap">
                <label class="unit-0 text-right" for="multiple-inputs-name">邮箱: </label>
                <div class="unit">
                  <input type="email" name="email" id="id_email" placeholder="请输入绑定邮箱"/>
                </div>
                <div class="unit-0">
                  <button class="btn" id="js-send" type="button"
                          data-target="/comments/ajax_verification_code/">发送验证码
                  </button>
                </div>
              </div>
              <div class="flex-left units-gap">
                <label class="unit-0 text-right" for="multiple-inputs-name">验证码: </label>
                <div class="unit">
                  <input type="text" name="verification_code" id="id_verification_code"
                         placeholder="请输入接收到的验证码"/>
                </div>
              </div>
              <div class="flex-right">
                <button type="button" class="btn btn-danger mr-3" data-dismiss="modal">关闭</button>
                <button type="submit" class="btn btn-primary" id="js-submit">设置</button>
              </div>
            </form>
          </div>
        </div><!-- /.modal-content -->
      </div><!-- /.modal -->
    </div>
    <div class="flex-left flex-wrap "
         style="margin-top: 60px">
      
  <aside class="unit-1-4 unit-1-on-mobile top-gap">
    <div class="scroll-view bg-white card toc-sidebar" style="height: 100%">
      <div class="card-header">
        目录
      </div>
      <div class="flex-left">
        <div class="unit-1-4">
          <a href="https://promotion.aliyun.com/ntms/act/group/team.html?group=FcfAncJPAp" target="_blank"><img
              src="/static/blog/images/aliyun.jpg" alt=""></a>
        </div>
        <div class="unit-1-2 flex-vertical top-gap text-small">
          <a style="color: #e83e8c" target="_blank"
             href="https://promotion.aliyun.com/ntms/act/group/team.html?group=FcfAncJPAp">云服务器新用户</a>
          <a style="color: #6610f2" target="_blank"
             href="https://promotion.aliyun.com/ntms/act/group/team.html?group=FcfAncJPAp">8元/月</a>
        </div>
      </div>
      <div class="card-body">
        <ul>
          <li>
            <h6 class="top-gap-0"><a href="">Django博客教程</a></h6>
            <ul>
              
                <li>
                  <a href="2.html">前言</a>
                  
                </li>
              
                <li>
                  <a href="3.html">搭建开发环境</a>
                  
                </li>
              
                <li>
                  <a href="4.html">建立 Django 博客应用</a>
                  
                </li>
              
                <li>
                  <a href="5.html">创建 Django 博客的数据库模型</a>
                  
                </li>
              
                <li>
                  <a href="6.html">让 Django 完成翻译：迁移数据库</a>
                  
                </li>
              
                <li>
                  <a href="7.html">Django 博客首页视图</a>
                  
                </li>
              
                <li>
                  <a href="8.html">真正的 Django 博客首页视图</a>
                  
                    <div class="toc">
<ul>
<li><a href="#首页视图函数">首页视图函数</a></li>
<li><a href="#处理静态文件">处理静态文件</a></li>
<li><a href="#修改模板">修改模板</a></li>
<li><a href="#总结">总结</a></li>
</ul>
</div>

                  
                </li>
              
                <li>
                  <a href="9.html">在 Django Admin 后台发布文章</a>
                  
                </li>
              
                <li>
                  <a href="10.html">博客文章详情页</a>
                  
                </li>
              
                <li>
                  <a href="11.html">支持 Markdown 语法和代码高亮</a>
                  
                </li>
              
                <li>
                  <a href="12.html">页面侧边栏：使用自定义模板标签</a>
                  
                </li>
              
                <li>
                  <a href="13.html">分类与归档</a>
                  
                </li>
              
                <li>
                  <a href="14.html">评论</a>
                  
                </li>
              
                <li>
                  <a href="16.html">已知小问题修正</a>
                  
                </li>
              
                <li>
                  <a href="20.html">使用 Nginx 和 Gunicorn 部署 Django 博客</a>
                  
                </li>
              
                <li>
                  <a href="21.html">使用 Fabric 自动化部署</a>
                  
                </li>
              
                <li>
                  <a href="29.html">统计文章阅读量</a>
                  
                </li>
              
                <li>
                  <a href="32.html">自动生成文章摘要</a>
                  
                </li>
              
                <li>
                  <a href="33.html">基于类的通用视图：ListView 和 DetailView</a>
                  
                </li>
              
                <li>
                  <a href="34.html">Django Pagination 简单分页</a>
                  
                </li>
              
                <li>
                  <a href="37.html">Django Pagination 完善分页</a>
                  
                </li>
              
                <li>
                  <a href="38.html">统计各个分类下的文章数</a>
                  
                </li>
              
                <li>
                  <a href="39.html">标签云</a>
                  
                </li>
              
                <li>
                  <a href="41.html">RSS 订阅</a>
                  
                </li>
              
                <li>
                  <a href="43.html">Markdown 自动生成文章目录</a>
                  
                </li>
              
                <li>
                  <a href="44.html">简单全文搜索</a>
                  
                </li>
              
                <li>
                  <a href="45.html">Django Haystack 全文检索与关键词高亮</a>
                  
                </li>
              
            </ul>
          </li>
        </ul>
      </div>
    </div>
  </aside>

      
  <div class="unit-3-4 unit-1-on-mobile top-gap">
    


<div class="bg-white card post-card px-7 py-5">
  
<article class="post">
  <h1 class="top-gap-0">真正的 Django 博客首页视图</h1>
  <ul class="list-inline dot-divider post-meta">
    <li class="list-inline-item text-small text-muted">
      12 月前
    </li>
    <li class="list-inline-item text-small text-muted">11248 字
    </li>
    <li class="list-inline-item text-small text-muted">
      47253 阅读
    </li>
    <li class="list-inline-item text-small text-muted">
      99 评论
    </li>
  </ul>
  <div class="top-gap-big post-body">
    <p>在此之前我们已经编写了 Blog 的首页视图，并且配置了 URL 和模板，让 Django 能够正确地处理 HTTP 请求并返回合适的 HTTP 响应。不过我们仅仅在首页返回了一句话：欢迎访问我的博客。这是个 Hello World 级别的视图函数，我们需要编写真正的首页视图函数，当用户访问我们的博客首页时，他将看到我们发表的博客文章列表，就像 <a href="http://demo.zmrenwu.com/">演示项目</a> 里展示的这样。</p>
<h2 id="首页视图函数">首页视图函数</h2>
<p>上一节我们阐明了 Django 的开发流程。即首先配置 URL，把 URL 和相应的视图函数绑定，一般写在 urls.py 文件里，然后在工程的 urls.py 文件引入。其次是编写视图函数，视图中需要渲染模板，我们也在 settings.py 中进行了模板相关的配置，让 Django 能够找到需要渲染的模板。最后把渲染完成的 HTTP 响应返回就可以了。相关的配置和准备工作都在之前完成了，这里我们只需专心编写视图函数，让它实现我们想要的功能即可。</p>
<p>首页的视图函数其实很简单，代码像这样：</p>
<div class="codehilite"><pre><span></span><span class="n">blog</span><span class="o">/</span><span class="n">views</span><span class="o">.</span><span class="n">py</span>

<span class="kn">from</span> <span class="nn">django.shortcuts</span> <span class="kn">import</span> <span class="n">render</span>
<span class="kn">from</span> <span class="nn">.models</span> <span class="kn">import</span> <span class="n">Post</span>

<span class="k">def</span> <span class="nf">index</span><span class="p">(</span><span class="n">request</span><span class="p">):</span>
    <span class="n">post_list</span> <span class="o">=</span> <span class="n">Post</span><span class="o">.</span><span class="n">objects</span><span class="o">.</span><span class="n">all</span><span class="p">()</span><span class="o">.</span><span class="n">order_by</span><span class="p">(</span><span class="s1">&#39;-created_time&#39;</span><span class="p">)</span>
    <span class="k">return</span> <span class="n">render</span><span class="p">(</span><span class="n">request</span><span class="p">,</span> <span class="s1">&#39;blog/index.html&#39;</span><span class="p">,</span> <span class="n">context</span><span class="o">=</span><span class="p">{</span><span class="s1">&#39;post_list&#39;</span><span class="p">:</span> <span class="n">post_list</span><span class="p">})</span>
</pre></div>


<p>我们曾经在前面的章节讲解过模型管理器 <code>objects</code> 的使用。这里我们使用 <code>all()</code> 方法从数据库里获取了全部的文章，存在了 <code>post_list</code> 变量里。<code>all</code> 方法返回的是一个 <code>QuerySet</code>（可以理解成一个类似于列表的数据结构），由于通常来说博客文章列表是按文章发表时间倒序排列的，即最新的文章排在最前面，所以我们紧接着调用了 <code>order_by</code> 方法对这个返回的 queryset 进行排序。排序依据的字段是 <code>created_time</code>，即文章的创建时间。<code>-</code> 号表示逆序，如果不加 <code>-</code> 则是正序。 接着如之前所做，我们渲染了 blog\index.html 模板文件，并且把包含文章列表数据的 <code>post_list</code> 变量传给了模板。</p>
<h2 id="处理静态文件">处理静态文件</h2>
<p>我们的项目使用了从网上下载的一套博客模板（<a href="https://github.com/zmrenwu/django-blog-tutorial-templates">点击这里下载全套模板</a>）。这里面除了 HTML 文档外，还包含了一些 CSS 文件和 JavaScript 文件以让网页呈现出我们现在看到的样式。同样我们需要对 Django 做一些必要的配置，才能让 Django 知道如何在开发服务器中引入这些 CSS 和 JavaScript 文件，这样才能让博客页面的 CSS 样式生效。</p>
<p>按照惯例，我们把 CSS 和 JavaScript 文件放在 <strong>blog 应用</strong>的 static\ 目录下。因此，先在 <strong>blog 应用</strong>下建立一个 static 文件夹。同时，为了避免和其它应用中的 CSS 和 JavaScript 文件命名冲突（别的应用下也可能有和 blog 应用下同名的 CSS 、JavaScript 文件），我们再在 static\ 目录下建立一个 blog 文件夹，把下载的博客模板中的 css 和 js 文件夹连同里面的全部文件一同拷贝进这个目录。最终我们的 blog 应用目录结构应该是这样的：</p>
<div class="codehilite"><pre><span></span>blog\
    __init__.py
    static\
        blog\
            css\
                .css 文件...
            js\
                .js 文件...
    admin.py
    apps.py
    migrations\
        __init__.py
    models.py
    tests.py
    views.py
</pre></div>


<p>用下载的博客模板中的 index.html 文件替换掉之前我们自己写的 index.html 文件。如果你好奇，现在就可以运行开发服务器，看看首页是什么样子。</p>
<p><img alt="未正确引入静态资源的博客首页" src="//bkt.zmrenwu.com/%E6%9C%AA%E6%AD%A3%E7%A1%AE%E5%BC%95%E5%85%A5%E9%9D%99%E6%80%81%E8%B5%84%E6%BA%90%E7%9A%84%E5%8D%9A%E5%AE%A2%E9%A6%96%E9%A1%B5.png" /></p>
<p>如图所示，你会看到首页显示的样式非常混乱，原因是浏览器无法正确加载 CSS 等样式文件。需要以 Django 的方式来正确地处理 CSS 和 JavaScript 等静态文件的加载路径。CSS 样式文件通常在 HTML 文档的 head 标签里引入，打开 index.html 文件，在文件的开始处找到 head 标签包裹的内容，大概像这样：</p>
<div class="codehilite"><pre><span></span>templates/blog/index.html

<span class="cp">&lt;!DOCTYPE html&gt;</span>
<span class="p">&lt;</span><span class="nt">html</span><span class="p">&gt;</span>
  <span class="p">&lt;</span><span class="nt">head</span><span class="p">&gt;</span>
      <span class="p">&lt;</span><span class="nt">title</span><span class="p">&gt;</span>Black <span class="ni">&amp;amp;</span> White<span class="p">&lt;/</span><span class="nt">title</span><span class="p">&gt;</span>

      <span class="c">&lt;!-- meta --&gt;</span>
      <span class="p">&lt;</span><span class="nt">meta</span> <span class="na">charset</span><span class="o">=</span><span class="s">&quot;UTF-8&quot;</span><span class="p">&gt;</span>
      <span class="p">&lt;</span><span class="nt">meta</span> <span class="na">name</span><span class="o">=</span><span class="s">&quot;viewport&quot;</span> <span class="na">content</span><span class="o">=</span><span class="s">&quot;width=device-width, initial-scale=1&quot;</span><span class="p">&gt;</span>

      <span class="c">&lt;!-- css --&gt;</span>
      <span class="p">&lt;</span><span class="nt">link</span> <span class="na">rel</span><span class="o">=</span><span class="s">&quot;stylesheet&quot;</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;css/bootstrap.min.css&quot;</span><span class="p">&gt;</span>
      <span class="p">&lt;</span><span class="nt">link</span> <span class="na">rel</span><span class="o">=</span><span class="s">&quot;stylesheet&quot;</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;ionicons.min.css&quot;</span><span class="p">&gt;</span>
      <span class="p">&lt;</span><span class="nt">link</span> <span class="na">rel</span><span class="o">=</span><span class="s">&quot;stylesheet&quot;</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;css/pace.css&quot;</span><span class="p">&gt;</span>
      <span class="p">&lt;</span><span class="nt">link</span> <span class="na">rel</span><span class="o">=</span><span class="s">&quot;stylesheet&quot;</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;css/custom.css&quot;</span><span class="p">&gt;</span>

      <span class="c">&lt;!-- js --&gt;</span>
      <span class="p">&lt;</span><span class="nt">script</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;js/jquery-2.1.3.min.js&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>
      <span class="p">&lt;</span><span class="nt">script</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;js/bootstrap.min.js&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>
      <span class="p">&lt;</span><span class="nt">script</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;js/pace.min.js&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>
      <span class="p">&lt;</span><span class="nt">script</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;js/modernizr.custom.js&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>
  <span class="p">&lt;/</span><span class="nt">head</span><span class="p">&gt;</span>
  <span class="p">&lt;</span><span class="nt">body</span><span class="p">&gt;</span>
      <span class="c">&lt;!-- 其它内容 --&gt;</span>
      <span class="p">&lt;</span><span class="nt">script</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;js/script.js&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>
  <span class="p">&lt;/</span><span class="nt">body</span><span class="p">&gt;</span>
<span class="p">&lt;/</span><span class="nt">html</span><span class="p">&gt;</span>
</pre></div>


<p>CSS 样式文件的路径在 link 标签的 href 属性里，而 JavaScript 文件的路径在 script 标签的 src 属性里。可以看到诸如 `href="css/bootstrap.min.css" 或者 src="js/jquery-2.1.3.min.js" 这样的引用，由于引用文件的路径不对，所以浏览器引入这些文件失败。我们需要把它们改成正确的路径。把代码改成下面样子，正确地引入 static 文件下的 CSS 和 JavaScript 文件：</p>
<div class="codehilite"><pre><span></span>templates/blog/index.html

+ {% load staticfiles %}
<span class="cp">&lt;!DOCTYPE html&gt;</span>
<span class="p">&lt;</span><span class="nt">html</span><span class="p">&gt;</span>
  <span class="p">&lt;</span><span class="nt">head</span><span class="p">&gt;</span>
      <span class="p">&lt;</span><span class="nt">title</span><span class="p">&gt;</span>Black <span class="ni">&amp;amp;</span> White<span class="p">&lt;/</span><span class="nt">title</span><span class="p">&gt;</span>

      <span class="c">&lt;!-- meta --&gt;</span>
      <span class="p">&lt;</span><span class="nt">meta</span> <span class="na">charset</span><span class="o">=</span><span class="s">&quot;UTF-8&quot;</span><span class="p">&gt;</span>
      <span class="p">&lt;</span><span class="nt">meta</span> <span class="na">name</span><span class="o">=</span><span class="s">&quot;viewport&quot;</span> <span class="na">content</span><span class="o">=</span><span class="s">&quot;width=device-width, initial-scale=1&quot;</span><span class="p">&gt;</span>

      <span class="c">&lt;!-- css --&gt;</span>
      - <span class="p">&lt;</span><span class="nt">link</span> <span class="na">rel</span><span class="o">=</span><span class="s">&quot;stylesheet&quot;</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;css/bootstrap.min.css&quot;</span><span class="p">&gt;</span>
      <span class="p">&lt;</span><span class="nt">link</span> <span class="na">rel</span><span class="o">=</span><span class="s">&quot;stylesheet&quot;</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;ionicons.min.css&quot;</span><span class="p">&gt;</span>
      - <span class="p">&lt;</span><span class="nt">link</span> <span class="na">rel</span><span class="o">=</span><span class="s">&quot;stylesheet&quot;</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;css/pace.css&quot;</span><span class="p">&gt;</span>
      - <span class="p">&lt;</span><span class="nt">link</span> <span class="na">rel</span><span class="o">=</span><span class="s">&quot;stylesheet&quot;</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;css/custom.css&quot;</span><span class="p">&gt;</span>
      + <span class="p">&lt;</span><span class="nt">link</span> <span class="na">rel</span><span class="o">=</span><span class="s">&quot;stylesheet&quot;</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;{% static &#39;blog/css/bootstrap.min.css&#39; %}&quot;</span><span class="p">&gt;</span>
      + <span class="p">&lt;</span><span class="nt">link</span> <span class="na">rel</span><span class="o">=</span><span class="s">&quot;stylesheet&quot;</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;{% static &#39;blog/css/pace.css&#39; %}&quot;</span><span class="p">&gt;</span>
      + <span class="p">&lt;</span><span class="nt">link</span> <span class="na">rel</span><span class="o">=</span><span class="s">&quot;stylesheet&quot;</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;{% static &#39;blog/css/custom.css&#39; %}&quot;</span><span class="p">&gt;</span>

      <span class="c">&lt;!-- js --&gt;</span>
      - <span class="p">&lt;</span><span class="nt">script</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;js/jquery-2.1.3.min.js&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>
      - <span class="p">&lt;</span><span class="nt">script</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;js/bootstrap.min.js&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>
      - <span class="p">&lt;</span><span class="nt">script</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;js/pace.min.js&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>
      - <span class="p">&lt;</span><span class="nt">script</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;js/modernizr.custom.js&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>
      + <span class="p">&lt;</span><span class="nt">script</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;{% static &#39;blog/js/jquery-2.1.3.min.js&#39; %}&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>
      + <span class="p">&lt;</span><span class="nt">script</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;{% static &#39;blog/js/bootstrap.min.js&#39; %}&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>
      + <span class="p">&lt;</span><span class="nt">script</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;{% static &#39;blog/js/pace.min.js&#39; %}&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>
      + <span class="p">&lt;</span><span class="nt">script</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;{% static &#39;blog/js/modernizr.custom.js&#39; %}&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>
  <span class="p">&lt;/</span><span class="nt">head</span><span class="p">&gt;</span>
  <span class="p">&lt;</span><span class="nt">body</span><span class="p">&gt;</span>
      <span class="c">&lt;!-- 其它内容 --&gt;</span>
      - <span class="p">&lt;</span><span class="nt">script</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;js/script.js&#39; %}&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>
      + <span class="p">&lt;</span><span class="nt">script</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;{% static &#39;blog/js/script.js&#39; %}&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>
  <span class="p">&lt;/</span><span class="nt">body</span><span class="p">&gt;</span>
<span class="p">&lt;/</span><span class="nt">html</span><span class="p">&gt;</span>
</pre></div>


<p>这里 - 表示删掉这一行，而 + 表示增加这一行。</p>
<p>我们把引用路径放在了一个奇怪的符号里，例如：href="bootstrap.min.css' %}"。用 {% %} 包裹起来的叫做模板标签。我们前面说过用 {{ }} 包裹起来的叫做模板变量，其作用是在最终渲染的模板里显示由视图函数传过来的变量值。而这里我们使用的模板标签的功能则类似于函数，例如这里的 <code>static</code> 模板标签，它把跟在后面的字符串 <code>'css/bootstrap.min.css'</code> 转换成正确的文件引入路径。这样 css 和 js 文件才能被正确加载，样式才能正常显示。</p>
<p><strong>为了能在模板中使用 {% static %} 模板标签，别忘了在最顶部 {% load staticfiles %} 。static 模板标签位于 staticfiles 模块中，只有通过 load 模板标签将该模块引入后，才能在模板中使用 {% static %} 标签。</strong></p>
<p>替换完成后你可以刷新页面并看看网页的源代码，看一看 {% static %} 模板标签在页面渲染后究竟被替换成了什么样的值。例如我们可以看到</p>
<div class="codehilite"><pre><span></span><span class="p">&lt;</span><span class="nt">link</span> <span class="na">rel</span><span class="o">=</span><span class="s">&quot;stylesheet&quot;</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;{% static &#39;blog/css/pace.css&#39; %}&quot;</span><span class="p">&gt;</span>
</pre></div>


<p>这一部分最终在浏览器中显示的是：</p>
<div class="codehilite"><pre><span></span><span class="p">&lt;</span><span class="nt">link</span> <span class="na">rel</span><span class="o">=</span><span class="s">&quot;stylesheet&quot;</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;pace.css&quot;</span><span class="p">&gt;</span>
</pre></div>


<p>这正是 pace.css 文件所在的路径，其它的文件路径也被类似替换。可以看到 {% static %} 标签的作用实际就是把后面的字符串加了一个 /static/ 前缀，比如 <code>pace.css' %}</code> 最终渲染的值是 <code>pace.css</code>。而 /static/ 前缀是我们在 settings.py  文件中通过 <code>STATIC_URL = '/static/'</code> 指定的。事实上，如果我们直接把引用路径写成 <code>pace.css</code> 也是可以的，那么为什么要使用  {% static %} 标签呢？想一下，目前 URL 的前缀是 /static/，如果哪一天因为某些原因，我们需要把 /static/ 改成 /resource/，如果你是直接写的引用路劲而没有使用 static 模板标签，那么你可能需要改 N 个地方。如果你使用了 static 模板标签，那么只要在 settings.py 处改一个地方就可以了，即把 <code>STATIC_URL = '/static/'</code> 改成 <code>STATIC_URL = '/resource/'</code>。</p>
<p><strong>有时候按 F5 刷新后页面还是很乱，这可能是因为浏览器缓存了之前的结果。按 Shift + F5（有些浏览器可能是 Ctrl + F5）强制刷新浏览器页面即可。</strong></p>
<p>注意这里有一个 CSS 文件的引入</p>
<div class="codehilite"><pre><span></span><span class="p">&lt;</span><span class="nt">link</span> <span class="na">rel</span><span class="o">=</span><span class="s">&quot;stylesheet&quot;</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;ionicons.min.css&quot;</span><span class="p">&gt;</span>
</pre></div>


<p>我们没有使用模板标签，因为这里的引用的文件是一个外部文件，不是我们项目里 static\blog\css\ 目录下的文件，因此无需使用模板标签。</p>
<p>正确引入了静态文件后样式显示正常了。</p>
<p><img alt="正确引入静态资源后的博客首页" src="//bkt.zmrenwu.com/%E6%AD%A3%E7%A1%AE%E5%BC%95%E5%85%A5%E9%9D%99%E6%80%81%E8%B5%84%E6%BA%90%E5%90%8E%E7%9A%84%E5%8D%9A%E5%AE%A2%E9%A6%96%E9%A1%B5.png" /></p>
<h2 id="修改模板">修改模板</h2>
<p>目前我们看到的只是模板中预先填充的一些数据，我们得让它显示从数据库中获取的文章数据。下面来稍微改造一下模板：</p>
<p>在模板 index.html 中你会找到一系列 article 标签：</p>
<div class="codehilite"><pre><span></span>templates/blog/index.html

...
<span class="p">&lt;</span><span class="nt">article</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;post post-1&quot;</span><span class="p">&gt;</span>
  ...
<span class="p">&lt;/</span><span class="nt">article</span><span class="p">&gt;</span>

<span class="p">&lt;</span><span class="nt">article</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;post post-2&quot;</span><span class="p">&gt;</span>
  ...
<span class="p">&lt;/</span><span class="nt">article</span><span class="p">&gt;</span>

<span class="p">&lt;</span><span class="nt">article</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;post post-3&quot;</span><span class="p">&gt;</span>
  ...
<span class="p">&lt;/</span><span class="nt">article</span><span class="p">&gt;</span>
...
</pre></div>


<p>这里面包裹的内容显示的就是文章数据了。我们前面在视图函数 index 里给模板传了一个 <code>post_list</code> 变量，它里面包含着从数据库中取出的文章列表数据。就像 Python 一样，我们可以在模板中循环这个列表，把文章一篇篇循环出来，然后一篇篇显示文章的数据。要在模板中使用循环，需要使用到前面提到的模板标签，这次使用 {% for %} 模板标签。将 index.html 中多余的 article 标签删掉，只留下一个 article 标签，然后写上下列代码：</p>
<div class="codehilite"><pre><span></span>templates/blog/index.html

...
{% for post in post_list %}
  <span class="p">&lt;</span><span class="nt">article</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;post post-{{ post.pk }}&quot;</span><span class="p">&gt;</span>
    ...
  <span class="p">&lt;/</span><span class="nt">article</span><span class="p">&gt;</span>
{% empty %}
  <span class="p">&lt;</span><span class="nt">div</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;no-post&quot;</span><span class="p">&gt;</span>暂时还没有发布的文章！<span class="p">&lt;/</span><span class="nt">div</span><span class="p">&gt;</span>
{% endfor %}
...
</pre></div>


<p>可以看到语法和 Python 的 for 循环类似，只是被 {% %} 这样一个模板标签符号包裹着。{% empty %} 的作用是当 <code>post_list</code> 为空，即数据库里没有文章时显示 {% empty %} 下面的内容，最后我们用 {% endfor %} 告诉 Django 循环在这里结束了。</p>
<p>你可能不太理解模板中的 <code>post</code> 和 <code>post_list</code> 是什么。<code>post_list</code> 是一个 <code>QuerySet</code>（类似于一个列表的数据结构），其中每一项都是之前定义在 blog\models.py 中的 Post 类的实例，且每个实例分别对应着数据库中每篇文章的记录。因此我们循环遍历 <code>post_list</code> ，每一次遍历的结果都保存在 <code>post</code> 变量里。所以我们使用模板变量来显示 <code>post</code> 的属性值。例如这里的 <code>{{ post.pk }}</code>（pk 是 primary key 的缩写，即 post 对应于数据库中记录的 id 值，该属性尽管我们没有显示定义，但是 Django 会自动为我们添加）。</p>
<p>现在我们可以在循环体内通过 <code>post</code> 变量访问单篇文章的数据了。分析 article 标签里面的 HTML 内容，h1 显示的是文章的标题，</p>
<div class="codehilite"><pre><span></span><span class="p">&lt;</span><span class="nt">h1</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;entry-title&quot;</span><span class="p">&gt;</span>
    <span class="p">&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;single.html&quot;</span><span class="p">&gt;</span>Adaptive Vs. Responsive Layouts And Optimal Text Readability<span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;</span>
<span class="p">&lt;/</span><span class="nt">h1</span><span class="p">&gt;</span>
</pre></div>


<p>我们把标题替换成 <code>post</code> 的 <code>title</code> 属性值。注意要把它包裹在模板变量里，因为它最终要被替换成实际的 title 值。</p>
<div class="codehilite"><pre><span></span><span class="p">&lt;</span><span class="nt">h1</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;entry-title&quot;</span><span class="p">&gt;</span>
    <span class="p">&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;single.html&quot;</span><span class="p">&gt;</span>{{ post.title }}<span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;</span>
<span class="p">&lt;/</span><span class="nt">h1</span><span class="p">&gt;</span>
</pre></div>


<p>下面这 5 个 span 标签里分别显示了分类（category）、文章发布时间、文章作者、评论数、阅读量。</p>
<div class="codehilite"><pre><span></span><span class="p">&lt;</span><span class="nt">div</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;entry-meta&quot;</span><span class="p">&gt;</span>
  <span class="p">&lt;</span><span class="nt">span</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;post-category&quot;</span><span class="p">&gt;&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;#&quot;</span><span class="p">&gt;</span>Django 博客教程<span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;&lt;/</span><span class="nt">span</span><span class="p">&gt;</span>
  <span class="p">&lt;</span><span class="nt">span</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;post-date&quot;</span><span class="p">&gt;&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;#&quot;</span><span class="p">&gt;&lt;</span><span class="nt">time</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;entry-date&quot;</span>
                                            <span class="na">datetime</span><span class="o">=</span><span class="s">&quot;2012-11-09T23:15:57+00:00&quot;</span><span class="p">&gt;</span>2017年5月11日<span class="p">&lt;/</span><span class="nt">time</span><span class="p">&gt;&lt;/</span><span class="nt">a</span><span class="p">&gt;&lt;/</span><span class="nt">span</span><span class="p">&gt;</span>
  <span class="p">&lt;</span><span class="nt">span</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;post-author&quot;</span><span class="p">&gt;&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;#&quot;</span><span class="p">&gt;</span>追梦人物<span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;&lt;/</span><span class="nt">span</span><span class="p">&gt;</span>
  <span class="p">&lt;</span><span class="nt">span</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;comments-link&quot;</span><span class="p">&gt;&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;#&quot;</span><span class="p">&gt;</span>4 评论<span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;&lt;/</span><span class="nt">span</span><span class="p">&gt;</span>
  <span class="p">&lt;</span><span class="nt">span</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;views-count&quot;</span><span class="p">&gt;&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;#&quot;</span><span class="p">&gt;</span>588 阅读<span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;&lt;/</span><span class="nt">span</span><span class="p">&gt;</span>
<span class="p">&lt;/</span><span class="nt">div</span><span class="p">&gt;</span>
</pre></div>


<p>再次替换掉一些数据，由于评论数和阅读量暂时没法替换，因此先留着，我们在之后实现了这些功能后再来修改它，目前只替换分类、文章发布时间、文章作者：</p>
<div class="codehilite"><pre><span></span><span class="p">&lt;</span><span class="nt">div</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;entry-meta&quot;</span><span class="p">&gt;</span>
  <span class="p">&lt;</span><span class="nt">span</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;post-category&quot;</span><span class="p">&gt;&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;#&quot;</span><span class="p">&gt;</span>{{ post.category.name }}<span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;&lt;/</span><span class="nt">span</span><span class="p">&gt;</span>
  <span class="p">&lt;</span><span class="nt">span</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;post-date&quot;</span><span class="p">&gt;&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;#&quot;</span><span class="p">&gt;&lt;</span><span class="nt">time</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;entry-date&quot;</span>
                                            <span class="na">datetime</span><span class="o">=</span><span class="s">&quot;{{ post.created_time }}&quot;</span><span class="p">&gt;</span>{{ post.created_time }}<span class="p">&lt;/</span><span class="nt">time</span><span class="p">&gt;&lt;/</span><span class="nt">a</span><span class="p">&gt;&lt;/</span><span class="nt">span</span><span class="p">&gt;</span>
  <span class="p">&lt;</span><span class="nt">span</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;post-author&quot;</span><span class="p">&gt;&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;#&quot;</span><span class="p">&gt;</span>{{ post.author }}<span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;&lt;/</span><span class="nt">span</span><span class="p">&gt;</span>
  <span class="p">&lt;</span><span class="nt">span</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;comments-link&quot;</span><span class="p">&gt;&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;#&quot;</span><span class="p">&gt;</span>4 评论<span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;&lt;/</span><span class="nt">span</span><span class="p">&gt;</span>
  <span class="p">&lt;</span><span class="nt">span</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;views-count&quot;</span><span class="p">&gt;&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;#&quot;</span><span class="p">&gt;</span>588 阅读<span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;&lt;/</span><span class="nt">span</span><span class="p">&gt;</span>
<span class="p">&lt;/</span><span class="nt">div</span><span class="p">&gt;</span>
</pre></div>


<p>这里 p 标签里显示的是摘要</p>
<div class="codehilite"><pre><span></span><span class="p">&lt;</span><span class="nt">div</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;entry-content clearfix&quot;</span><span class="p">&gt;</span>
  <span class="p">&lt;</span><span class="nt">p</span><span class="p">&gt;</span>免费、中文、零基础，完整的项目，基于最新版 Django 1.10 和 Python 3.5。带你从零开始一步步开发属于自己的博客网站，帮助你以最快的速度掌握 Django
    开发的技巧...<span class="p">&lt;/</span><span class="nt">p</span><span class="p">&gt;</span>
  <span class="p">&lt;</span><span class="nt">div</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;read-more cl-effect-14&quot;</span><span class="p">&gt;</span>
    <span class="p">&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;#&quot;</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;more-link&quot;</span><span class="p">&gt;</span>继续阅读 <span class="p">&lt;</span><span class="nt">span</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;meta-nav&quot;</span><span class="p">&gt;</span>→<span class="p">&lt;/</span><span class="nt">span</span><span class="p">&gt;&lt;/</span><span class="nt">a</span><span class="p">&gt;</span>
  <span class="p">&lt;/</span><span class="nt">div</span><span class="p">&gt;</span>
<span class="p">&lt;/</span><span class="nt">div</span><span class="p">&gt;</span>
</pre></div>


<p>替换成 <code>post</code> 的摘要：</p>
<div class="codehilite"><pre><span></span><span class="p">&lt;</span><span class="nt">div</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;entry-content clearfix&quot;</span><span class="p">&gt;</span>
  <span class="p">&lt;</span><span class="nt">p</span><span class="p">&gt;</span>{{ post.excerpt }}<span class="p">&lt;/</span><span class="nt">p</span><span class="p">&gt;</span>
  <span class="p">&lt;</span><span class="nt">div</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;read-more cl-effect-14&quot;</span><span class="p">&gt;</span>
    <span class="p">&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;#&quot;</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;more-link&quot;</span><span class="p">&gt;</span>继续阅读 <span class="p">&lt;</span><span class="nt">span</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;meta-nav&quot;</span><span class="p">&gt;</span>→<span class="p">&lt;/</span><span class="nt">span</span><span class="p">&gt;&lt;/</span><span class="nt">a</span><span class="p">&gt;</span>
  <span class="p">&lt;/</span><span class="nt">div</span><span class="p">&gt;</span>
<span class="p">&lt;/</span><span class="nt">div</span><span class="p">&gt;</span>
</pre></div>


<p>再次访问首页，它显示：暂时还没有发布的文章！好吧，做了这么多工作，但是数据库中其实还没有任何数据呀！接下来我们就实际写几篇文章保存到数据库里，看看显示的效果究竟如何。</p>
<h2 id="总结">总结</h2>
<p>本章节的代码位于：<a href="https://github.com/zmrenwu/django-blog-tutorial/tree/Step6_real-blog-index-view">Step6: real blog index view</a>。</p>
<p>如果遇到问题，请通过下面的方式寻求帮助。</p>
<ul>
<li>在下方评论区留言。</li>
<li>将问题的详细描述通过邮件发送到 djangostudyteam@163.com，一般会在 24 小时内回复。</li>
<li>在 <a href="http://www.pythonzh.cn/category/newbie-qa/">Pythonzhcn 社区的新手问答版块</a> 发布帖子。</li>
</ul>
    <p class="text-center">
      -- EOF --
    </p>
    <div>
      <button class="btn btn-primary" id="js-reward"><i class="fa fa-jpy"
                                                        aria-hidden="true"></i>
        如果觉得文章对你有帮助，请随意打赏
        <i class="fa fa-chevron-down" aria-hidden="true"></i>
      </button>
      <div class="flex-left flex-wrap units-gap-big mt-4" style="display: none">
        <div class="unit unit-1-on-mobile flex-center">
          <figure>
            <img src="/static/blog/images/weixinpay.jpg" alt="微信支付收款二维码"
                 style="width: 250px">
            <figcaption class="text-center fs-6 mt-2" style="color: green">微信</figcaption>
          </figure>
        </div>
        <div class="unit unit-1-on-mobile flex-center">
          <figure>
            <img src="/static/blog/images/alipay.jpg" alt="支付宝收款二维码" style="width: 250px">
            <figcaption class="text-center fs-6 mt-2 text-primary">支付宝</figcaption>
          </figure>
        </div>
      </div>
    </div>
    <div class="post-tags">
      <ul class="list-inline">
        
      </ul>
    </div>
  </div>
</article>
  <div class="top-gap">
    <div class="jiathis_style">
      <span class="jiathis_txt">分享到：</span>
      <a class="jiathis_button_qzone">QQ空间</a>
      <a class="jiathis_button_tsina">新浪微博</a>
      <a class="jiathis_button_tqq">腾讯微博</a>
      <a class="jiathis_button_weixin">微信</a>
      <a href="http://www.jiathis.com/share?uid=2128865"
         class="jiathis jiathis_txt jiathis_separator jtico jtico_jiathis"
         target="_blank">更多</a>
      <a class="jiathis_counter_style"></a>
    </div>
    <script type="text/javascript">
        var jiathis_config = {data_track_clickback: 'true'};
    </script>
    <script type="text/javascript" src="http://v3.jiathis.com/code/jia.js?uid=2128865"
            charset="utf-8"></script>
    <!-- JiaThis Button END -->
  </div>
  <br>
  <div class="top-gap clearfix">
    
      <a href="7.html">
        <i class="fa fa-angle-double-left" aria-hidden="true"></i>
        Django 博客首页视图
      </a>
    
    
      <a class="float-right" href="9.html">
        在 Django Admin 后台发布文章
        <i class="fa fa-angle-double-right" aria-hidden="true"></i>
      </a>
    
  </div>
  

  <section class="comment-area top-gap-big" id="comment-area">
    <h5>99 条评论 / 55 人参与</h5>
    
      
<div class="flex-center top-gap login-panel p-7">
  <div>
    <div class="text-muted text-center login-header"><span>登录后回复</span></div>
    <div class="flex-center text-center social-icons mt-3">
                        <span class="weibo mr-3">
                            <a href="/accounts/weibo/login/">
                                <i class="fa fa-weibo" aria-hidden="true"></i>
                            </a>
                        </span>
      <span class="github">
                            <a href="/accounts/github/login/">
                                <i class="fa fa-github" aria-hidden="true"></i>
                            </a>
                        </span>
    </div>
  </div>
</div>
    
    <div class="top-gap-big comment-list">
  
    <div class="flex-left py-4" id="c2331">
      <div class="unit-0">
        <img class="comment-avatar mr-3" src="https://avatars2.githubusercontent.com/u/19874684?v=4"/>
      </div>
      <div class="unit">
        <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">jizhongwei
          
        </span>
    
  </header>
  <div class="comment-body">
    <p style="">博主，感谢您优质的教程，有个疑问，为什么要在index.html文档最后加上&lt;script src="{% static 'blog/js/script.js' %}"&gt;&lt;/script&gt;，而不是跟其他一起加上去呢？谢谢<br></p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">1 月前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/2331"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>
        
        <div class="comment-descendant-list">
          
        </div>
      </div>
    </div>
    
      <hr class="m-0">
    
  
    <div class="flex-left py-4" id="c2298">
      <div class="unit-0">
        <img class="comment-avatar mr-3" src="https://avatars2.githubusercontent.com/u/19235266?v=4"/>
      </div>
      <div class="unit">
        <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">shaoyan
          
        </span>
    
  </header>
  <div class="comment-body">
    <p>用 django2 版本的，需要在 setting.py 设置：STATICFILES_DIRS = [    os.path.join(BASE_DIR, 'static')] 才能加载 css js 文件</p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">1 月，1 周前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/2298"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>
        
          <hr class="">
        
        <div class="comment-descendant-list">
          
            <div class="flex-left py-4" id="c2299">
              <div class="unit-0">
                <img class="comment-avatar mr-3" src="http://tvax4.sinaimg.cn/crop.0.0.664.664.180/006KF3Z1ly8fe11zgs10bj30ig0igmz0.jpg"/>
              </div>
              <div class="unit">
                
  <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">简单分行
          
        </span>
    
    <span class="reply-label text-small text-muted">
                                                        <i class="fa fa-share" aria-hidden="true"></i>
                                                    </span>
    <span class="nickname text-small text-muted">shaoyan
        

  </header>
  <div class="comment-body">
    <p>不用加啊</p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">1 月，1 周前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/2299"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>

              </div>
            </div>
            
              <hr class="m-0">
            
          
            <div class="flex-left py-4" id="c2305">
              <div class="unit-0">
                <img class="comment-avatar mr-3" src="http://tvax4.sinaimg.cn/crop.0.0.664.664.180/006KF3Z1ly8fe11zgs10bj30ig0igmz0.jpg"/>
              </div>
              <div class="unit">
                
  <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">简单分行
          
        </span>
    
    <span class="reply-label text-small text-muted">
                                                        <i class="fa fa-share" aria-hidden="true"></i>
                                                    </span>
    <span class="nickname text-small text-muted">简单分行
        

  </header>
  <div class="comment-body">
    <p>好吧,我搞错版本了</p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">1 月，1 周前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/2305"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>

              </div>
            </div>
            
          
        </div>
      </div>
    </div>
    
      <hr class="m-0">
    
  
    <div class="flex-left py-4" id="c2296">
      <div class="unit-0">
        <img class="comment-avatar mr-3" src="http://tva2.sinaimg.cn/crop.0.0.1080.1080.180/5ec2a85bjw8eh4ja956ryj20u00u0abc.jpg"/>
      </div>
      <div class="unit">
        <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">秋秋秋秋方
          
        </span>
    
  </header>
  <div class="comment-body">
    <p>百度了一下静态文件,发现要添加个东西才可以,要不然加载不出样式.....................</p><p><br></p><p>Django添加静态文件有两种方法：首先setting.py配置文件中添加静态文件的路径：STATICFILES_DIRS = [ os.path.join(BASE_DIR, "statics"),]&nbsp; statices为你所建立的存放静态文件的文件夹名然后进行引用。1、html 文件中通过 /static/资源名的方式，就可以访问到资源2、①html 文件头部填写&nbsp; {% load staticfiles %}，②路径填写&nbsp; {% static 'css/xx.css' %}&nbsp; #static 等于配置文件中的 STATIC_URL = '/static/'，可以按照需要进行修改，意义不大就是了。<br></p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">1 月，1 周前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/2296"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>
        
        <div class="comment-descendant-list">
          
        </div>
      </div>
    </div>
    
      <hr class="m-0">
    
  
    <div class="flex-left py-4" id="c2087">
      <div class="unit-0">
        <img class="comment-avatar mr-3" src="http://tva1.sinaimg.cn/crop.0.0.640.640.180/b1c8680bjw8ewag7ht3cuj20hs0hs757.jpg"/>
      </div>
      <div class="unit">
        <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">等一片枫叶
          
        </span>
    
  </header>
  <div class="comment-body">
    <p>在浏览器也能显示正常的路径，为什么样式加载不出来呢？也没有报错</p><p>&nbsp;&lt;link rel="stylesheet" href="bootstrap.min.css"&gt;</p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">3 月，1 周前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/2087"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>
        
          <hr class="">
        
        <div class="comment-descendant-list">
          
            <div class="flex-left py-4" id="c2219">
              <div class="unit-0">
                <img class="comment-avatar mr-3" src="https://avatars0.githubusercontent.com/u/26767147?v=4"/>
              </div>
              <div class="unit">
                
  <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">周磊
          
        </span>
    
    <span class="reply-label text-small text-muted">
                                                        <i class="fa fa-share" aria-hidden="true"></i>
                                                    </span>
    <span class="nickname text-small text-muted">等一片枫叶
        

  </header>
  <div class="comment-body">
    <p style="">同问　本人使用的ｄｊａｎｇｏ2.0版本，请问与博文版本有什么需要注意的区别吗<br></p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">2 月，1 周前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/2219"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>

              </div>
            </div>
            
              <hr class="m-0">
            
          
            <div class="flex-left py-4" id="c2238">
              <div class="unit-0">
                <img class="comment-avatar mr-3" src="https://avatars2.githubusercontent.com/u/11845936?v=4"/>
              </div>
              <div class="unit">
                
  <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">fans
          
        </span>
    
    <span class="reply-label text-small text-muted">
                                                        <i class="fa fa-share" aria-hidden="true"></i>
                                                    </span>
    <span class="nickname text-small text-muted">等一片枫叶
        

  </header>
  <div class="comment-body">
    <p>这里是答案：&nbsp;<a href="https://docs.djangoproject.com/en/1.10/howto/static-files/" rel="nofollow">https://docs.djangoproject.com/en/1.10/howto/static-files/</a><br></p><p>settings需要添加：</p><p>STATICFILES_DIRS = [os.path.join(BASE_DIR, "static"),]<br></p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">2 月前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/2238"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>

              </div>
            </div>
            
              <hr class="m-0">
            
          
            <div class="flex-left py-4" id="c2259">
              <div class="unit-0">
                <img class="comment-avatar mr-3" src="https://avatars3.githubusercontent.com/u/29800726?v=4"/>
              </div>
              <div class="unit">
                
  <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">何睿
          
        </span>
    
    <span class="reply-label text-small text-muted">
                                                        <i class="fa fa-share" aria-hidden="true"></i>
                                                    </span>
    <span class="nickname text-small text-muted">等一片枫叶
        

  </header>
  <div class="comment-body">
    <p>请问问题解决了吗,我也遇到了同样的问题，浏览器能够正确的显示链接: &lt;link rel="stylesheet" href="pace.css"&gt;，但是还是无法加载样式,点击链接，浏览器显示:The requested URL /static/blog/css/highlights/github.css was not found on this server.</p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">1 月，3 周前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/2259"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>

              </div>
            </div>
            
              <hr class="m-0">
            
          
            <div class="flex-left py-4" id="c2260">
              <div class="unit-0">
                <img class="comment-avatar mr-3" src="https://avatars3.githubusercontent.com/u/29800726?v=4"/>
              </div>
              <div class="unit">
                
  <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">何睿
          
        </span>
    
    <span class="reply-label text-small text-muted">
                                                        <i class="fa fa-share" aria-hidden="true"></i>
                                                    </span>
    <span class="nickname text-small text-muted">等一片枫叶
        

  </header>
  <div class="comment-body">
    <p>请问问题解决了吗,我也遇到了同样的问题，浏览器能够正确的显示链接: &lt;link rel="stylesheet" href="pace.css"&gt;，但是还是无法加载样式,点击链接，浏览器显示:The requested URL pace.css was not found on this server.</p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">1 月，3 周前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/2260"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>

              </div>
            </div>
            
              <hr class="m-0">
            
          
            <div class="flex-left py-4" id="c2261">
              <div class="unit-0">
                <img class="comment-avatar mr-3" src="https://avatars3.githubusercontent.com/u/29800726?v=4"/>
              </div>
              <div class="unit">
                
  <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">何睿
          
        </span>
    
    <span class="reply-label text-small text-muted">
                                                        <i class="fa fa-share" aria-hidden="true"></i>
                                                    </span>
    <span class="nickname text-small text-muted">fans
        

  </header>
  <div class="comment-body">
    <p>不知道为啥，部署到服务器（Centos7）是没有问题的，但是本地（Windows 10）显示就是有问题，提示找不到文件。</p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">1 月，3 周前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/2261"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>

              </div>
            </div>
            
              <hr class="m-0">
            
          
            <div class="flex-left py-4" id="c2268">
              <div class="unit-0">
                <img class="comment-avatar mr-3" src="https://avatars2.githubusercontent.com/u/11845936?v=4"/>
              </div>
              <div class="unit">
                
  <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">fans
          
        </span>
    
    <span class="reply-label text-small text-muted">
                                                        <i class="fa fa-share" aria-hidden="true"></i>
                                                    </span>
    <span class="nickname text-small text-muted">何睿
        

  </header>
  <div class="comment-body">
    <p>那就不知道了，我用的mac ^_^</p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">1 月，3 周前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/2268"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>

              </div>
            </div>
            
          
        </div>
      </div>
    </div>
    
      <hr class="m-0">
    
  
    <div class="flex-left py-4" id="c2084">
      <div class="unit-0">
        <img class="comment-avatar mr-3" src="https://avatars3.githubusercontent.com/u/26292523?v=4"/>
      </div>
      <div class="unit">
        <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">cbwood
          
        </span>
    
  </header>
  <div class="comment-body">
    <p style="">请问php格式的文件应该怎么样弄呢<br></p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">3 月，1 周前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/2084"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>
        
          <hr class="">
        
        <div class="comment-descendant-list">
          
            <div class="flex-left py-4" id="c2239">
              <div class="unit-0">
                <img class="comment-avatar mr-3" src="https://avatars2.githubusercontent.com/u/11845936?v=4"/>
              </div>
              <div class="unit">
                
  <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">fans
          
        </span>
    
    <span class="reply-label text-small text-muted">
                                                        <i class="fa fa-share" aria-hidden="true"></i>
                                                    </span>
    <span class="nickname text-small text-muted">cbwood
        

  </header>
  <div class="comment-body">
    <p>php格式的文件只能用PHP解析吧，和Python没什么关系应该。</p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">2 月前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/2239"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>

              </div>
            </div>
            
          
        </div>
      </div>
    </div>
    
      <hr class="m-0">
    
  
    <div class="flex-left py-4" id="c2022">
      <div class="unit-0">
        <img class="comment-avatar mr-3" src="https://avatars1.githubusercontent.com/u/33215688?v=4"/>
      </div>
      <div class="unit">
        <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">ultra-hao
          
        </span>
    
  </header>
  <div class="comment-body">
    <p>{ % for post in post_list % }&nbsp;&nbsp;</p><p>4 评论&nbsp;588 阅读&nbsp;</p><p>&nbsp;继续阅读&nbsp;→</p><p>{ % empty %}暂时还没有发布的文章！</p><p>&nbsp;{ % endfor %}&nbsp;<br></p><p><br></p><p>我的页面中为什么会显示{}中的内容</p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">3 月，2 周前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/2022"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>
        
          <hr class="">
        
        <div class="comment-descendant-list">
          
            <div class="flex-left py-4" id="c2052">
              <div class="unit-0">
                <img class="comment-avatar mr-3" src="https://avatars2.githubusercontent.com/u/13174219?v=4"/>
              </div>
              <div class="unit">
                
  <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">追梦人物
          
            <span class="master">[博主]</span>
          
        </span>
    
    <span class="reply-label text-small text-muted">
                                                        <i class="fa fa-share" aria-hidden="true"></i>
                                                    </span>
    <span class="nickname text-small text-muted">ultra-hao
        

  </header>
  <div class="comment-body">
    <p>{ % 符号必须挨在一起，中间不能有空格！{%</p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">3 月，2 周前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/2052"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>

              </div>
            </div>
            
              <hr class="m-0">
            
          
            <div class="flex-left py-4" id="c2400">
              <div class="unit-0">
                <img class="comment-avatar mr-3" src="http://tvax2.sinaimg.cn/default/images/default_avatar_male_180.gif"/>
              </div>
              <div class="unit">
                
  <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">安天崖
          
        </span>
    
    <span class="reply-label text-small text-muted">
                                                        <i class="fa fa-share" aria-hidden="true"></i>
                                                    </span>
    <span class="nickname text-small text-muted">追梦人物
        
            <span class="master">[博主]</span>
        

  </header>
  <div class="comment-body">
    <p>即使没有挨在一起，也显示了</p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">6 日，14 小时前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/2400"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>

              </div>
            </div>
            
          
        </div>
      </div>
    </div>
    
      <hr class="m-0">
    
  
    <div class="flex-left py-4" id="c2021">
      <div class="unit-0">
        <img class="comment-avatar mr-3" src="https://avatars1.githubusercontent.com/u/33215688?v=4"/>
      </div>
      <div class="unit">
        <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">ultra-hao
          
        </span>
    
  </header>
  <div class="comment-body">
    <p><img alt="Image"><br></p><p>博主，麻烦问一下为什么我的显示成这样</p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">3 月，2 周前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/2021"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>
        
        <div class="comment-descendant-list">
          
        </div>
      </div>
    </div>
    
      <hr class="m-0">
    
  
    <div class="flex-left py-4" id="c1970">
      <div class="unit-0">
        <img class="comment-avatar mr-3" src="http://tva2.sinaimg.cn/crop.0.0.180.180.180/e8d04c5ejw8eam3050saqj2050050746.jpg"/>
      </div>
      <div class="unit">
        <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">Simoral
          
        </span>
    
  </header>
  <div class="comment-body">
    <p style=""># 出现问题</p><p style="">## 问题描述：<br></p><p style="">&gt; django.db.utils.OperationalError: no such column: blogapp_post.created_time</p><p style="">## 解决方案：</p><p style="">重新迁移数据库，执行***python manage.py migrate***在虚拟环境内</p><p style="">```cmd</p><p style="">python manage.py migrate<br></p><p style="">```</p><p style="">## 思考与总结</p><p style="">可能是我一开始打错了，将**created_time**错打成了**create_time**，后来忘记了做数据库迁移<br></p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">4 月前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/1970"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>
        
        <div class="comment-descendant-list">
          
        </div>
      </div>
    </div>
    
      <hr class="m-0">
    
  
    <div class="flex-left py-4" id="c1945">
      <div class="unit-0">
        <img class="comment-avatar mr-3" src="https://avatars0.githubusercontent.com/u/12825367?v=4"/>
      </div>
      <div class="unit">
        <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">dragon1061
          
        </span>
    
  </header>
  <div class="comment-body">
    <p><font><font>博主你好 按你这章的操作，但是没有跳转detail.html</font></font><br><br></p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">4 月前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/1945"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>
        
        <div class="comment-descendant-list">
          
        </div>
      </div>
    </div>
    
      <hr class="m-0">
    
  
    <div class="flex-left py-4" id="c1854">
      <div class="unit-0">
        <img class="comment-avatar mr-3" src="https://avatars2.githubusercontent.com/u/7594150?v=4"/>
      </div>
      <div class="unit">
        <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">rookie250
          
        </span>
    
  </header>
  <div class="comment-body">
    <p>关于html引用css,js这个细节 我还有一点不明白 请教一下楼主</p><p>pace.css' %}&nbsp;最终渲染的值是&nbsp;pace.css。index.html在blogproject/template/blog 目录。 而我们的css文件在 blogproject/blog/static/blog/css目录。<br></p><p>即 index.html 绝对路径 blogproject/template/blog&nbsp;&nbsp;</p><p>pace.css 绝对路径&nbsp; &nbsp; &nbsp; &nbsp;blogproject/blog/static/blog/css</p><p>他们绝对路径完全不同，在index.html 使用相对路径 pace.css。为什么会可以找到blogproject/blog/static/blog/css这个绝对路径</p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">4 月，2 周前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/1854"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>
        
          <hr class="">
        
        <div class="comment-descendant-list">
          
            <div class="flex-left py-4" id="c1860">
              <div class="unit-0">
                <img class="comment-avatar mr-3" src="https://avatars1.githubusercontent.com/u/33719428?v=4"/>
              </div>
              <div class="unit">
                
  <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">xushuangang
          
        </span>
    
    <span class="reply-label text-small text-muted">
                                                        <i class="fa fa-share" aria-hidden="true"></i>
                                                    </span>
    <span class="nickname text-small text-muted">rookie250
        

  </header>
  <div class="comment-body">
    <p>您的疑问与我的疑问相同，为什么index.html可以正确的找到css/js的文件，他们的位置在不同路径下，</p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">4 月，2 周前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/1860"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>

              </div>
            </div>
            
              <hr class="m-0">
            
          
            <div class="flex-left py-4" id="c1861">
              <div class="unit-0">
                <img class="comment-avatar mr-3" src="https://avatars2.githubusercontent.com/u/7594150?v=4"/>
              </div>
              <div class="unit">
                
  <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">rookie250
          
        </span>
    
    <span class="reply-label text-small text-muted">
                                                        <i class="fa fa-share" aria-hidden="true"></i>
                                                    </span>
    <span class="nickname text-small text-muted">xushuangang
        

  </header>
  <div class="comment-body">
    <p>是的 哈哈</p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">4 月，2 周前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/1861"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>

              </div>
            </div>
            
              <hr class="m-0">
            
          
            <div class="flex-left py-4" id="c1862">
              <div class="unit-0">
                <img class="comment-avatar mr-3" src="https://avatars2.githubusercontent.com/u/7594150?v=4"/>
              </div>
              <div class="unit">
                
  <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">rookie250
          
        </span>
    
    <span class="reply-label text-small text-muted">
                                                        <i class="fa fa-share" aria-hidden="true"></i>
                                                    </span>
    <span class="nickname text-small text-muted">xushuangang
        

  </header>
  <div class="comment-body">
    <p>也许这里是答案： <a href="https://docs.djangoproject.com/en/1.10/howto/static-files/" rel="nofollow">https://docs.djangoproject.com/en/1.10/howto/static-files/</a><br></p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">4 月，2 周前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/1862"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>

              </div>
            </div>
            
              <hr class="m-0">
            
          
            <div class="flex-left py-4" id="c1947">
              <div class="unit-0">
                <img class="comment-avatar mr-3" src="http://tva3.sinaimg.cn/crop.19.31.315.315.180/47a33603jw8f3rptqa0kzj20a50a574u.jpg"/>
              </div>
              <div class="unit">
                
  <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">口腔哥
          
        </span>
    
    <span class="reply-label text-small text-muted">
                                                        <i class="fa fa-share" aria-hidden="true"></i>
                                                    </span>
    <span class="nickname text-small text-muted">rookie250
        

  </header>
  <div class="comment-body">
    <p>这个是正解</p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">4 月前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/1947"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>

              </div>
            </div>
            
          
        </div>
      </div>
    </div>
    
      <hr class="m-0">
    
  
    <div class="flex-left py-4" id="c1853">
      <div class="unit-0">
        <img class="comment-avatar mr-3" src="https://avatars1.githubusercontent.com/u/33719428?v=4"/>
      </div>
      <div class="unit">
        <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">xushuangang
          
        </span>
    
  </header>
  <div class="comment-body">
    <p>您好：</p><p style="margin-left: 40px;">关于此博客我有两个疑问：</p><p style="margin-left: 40px;">1&nbsp; 咱们在models.py中定义了函数，</p><p style="margin-left: 40px;">&nbsp; def __str__(self):&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</p><p style="margin-left: 80px;">return self.title</p><p style="margin-left: 80px;">在交换环境下，我也看到了数据确实返回了tille的格式，<br></p><p style="margin-left: 80px;">但是在index.html中，我们却用post.title，post.author等字段，</p><p style="margin-left: 80px;">请问，这个函数的作用只是改变数据的显示？？&nbsp; 实际上仍然返回所有字段？？</p><p style="margin-left: 80px;">2&nbsp; 咱们在index.html中使用了{% static %}方法，我在日志中抓到的值为/static/blog/js/script.js,也就是在模板中的配置"{% static 'blog/js/script.js' %}"&gt;中，将setting.py的STATIC_URL = '/static/'，与&nbsp;'blog/js/script.js' 做了拼接，</p><p style="margin-left: 80px;">疑问如下，</p><p style="margin-left: 80px;">setting.py的配置STATIC_URL = '/static/'，在/home/xushuangang/blogproject/blogproject下,BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))，那为什么会去查找blog/static，而不是BASE_DIR/static，或者说&nbsp;他会依次查找BASE_DIR/static,INSTALLED_APPS&nbsp;下所有的app/static？？？<br></p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">4 月，2 周前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/1853"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>
        
        <div class="comment-descendant-list">
          
        </div>
      </div>
    </div>
    
      <hr class="m-0">
    
  
    <div class="flex-left py-4" id="c1838">
      <div class="unit-0">
        <img class="comment-avatar mr-3" src="https://avatars2.githubusercontent.com/u/7594150?v=4"/>
      </div>
      <div class="unit">
        <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">rookie250
          
        </span>
    
  </header>
  <div class="comment-body">
    <p>为了避免和其它应用中的 CSS 和 JavaScript 文件命名冲突（别的应用下也可能有和 blog 应用下同名的 CSS 、JavaScript 文件），我们再在 static\ 目录下建立一个 blog 文件夹<br></p><p>直接放在blog/static下不行么？ 其他app（如comment app）的目录不是comment/static 么？ 为什么会混淆了？</p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">4 月，3 周前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/1838"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>
        
          <hr class="">
        
        <div class="comment-descendant-list">
          
            <div class="flex-left py-4" id="c1841">
              <div class="unit-0">
                <img class="comment-avatar mr-3" src="https://avatars2.githubusercontent.com/u/13174219?v=4"/>
              </div>
              <div class="unit">
                
  <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">追梦人物
          
            <span class="master">[博主]</span>
          
        </span>
    
    <span class="reply-label text-small text-muted">
                                                        <i class="fa fa-share" aria-hidden="true"></i>
                                                    </span>
    <span class="nickname text-small text-muted">rookie250
        

  </header>
  <div class="comment-body">
    <p>django的app名不作为静态文件的命名空间好像。</p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">4 月，3 周前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/1841"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>

              </div>
            </div>
            
              <hr class="m-0">
            
          
            <div class="flex-left py-4" id="c1938">
              <div class="unit-0">
                <img class="comment-avatar mr-3" src="https://avatars2.githubusercontent.com/u/12670670?v=4"/>
              </div>
              <div class="unit">
                
  <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">jing.wang
          
        </span>
    
    <span class="reply-label text-small text-muted">
                                                        <i class="fa fa-share" aria-hidden="true"></i>
                                                    </span>
    <span class="nickname text-small text-muted">追梦人物
        
            <span class="master">[博主]</span>
        

  </header>
  <div class="comment-body">
    <p>可以在　根url 中添加　namespace</p><pre><code class="lang-python">urlpatterns = [<br />&nbsp; &nbsp; url(r'^admin/', admin.site.urls),<br />&nbsp; &nbsp; url(r'',include('blog.urls', namespace="home")),<br />]<br /><br></code></pre>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">4 月前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/1938"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>

              </div>
            </div>
            
          
        </div>
      </div>
    </div>
    
      <hr class="m-0">
    
  
    <div class="flex-left py-4" id="c1595">
      <div class="unit-0">
        <img class="comment-avatar mr-3" src="http://tvax2.sinaimg.cn/crop.0.0.512.512.180/8f3f44cbly8fmj5qwxadyj20e80e8mxy.jpg"/>
      </div>
      <div class="unit">
        <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">YoJohnDoe
          
        </span>
    
  </header>
  <div class="comment-body">
    <p>在修改模板前没问题 修改后打开首页显示A server error occurred.  Please contact the administrator.<br></p><p>终端显示：pytz.exceptions.UnknownTimeZoneError: 'Asia/shanghai'[15/Oct/2017 03:07:57] "GET / HTTP/1.1" 500 59</p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">5 月，3 周前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/1595"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>
        
          <hr class="">
        
        <div class="comment-descendant-list">
          
            <div class="flex-left py-4" id="c1596">
              <div class="unit-0">
                <img class="comment-avatar mr-3" src="http://tvax2.sinaimg.cn/crop.0.0.512.512.180/8f3f44cbly8fmj5qwxadyj20e80e8mxy.jpg"/>
              </div>
              <div class="unit">
                
  <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">YoJohnDoe
          
        </span>
    
    <span class="reply-label text-small text-muted">
                                                        <i class="fa fa-share" aria-hidden="true"></i>
                                                    </span>
    <span class="nickname text-small text-muted">YoJohnDoe
        

  </header>
  <div class="comment-body">
    <p>已解决。。。 ‘Asia/shanghai’ 改为‘Asia/Shanghai’。。。留给和我一样粗心的人</p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">5 月，3 周前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/1596"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>

              </div>
            </div>
            
          
        </div>
      </div>
    </div>
    
      <hr class="m-0">
    
  
    <div class="flex-left py-4" id="c1583">
      <div class="unit-0">
        <img class="comment-avatar mr-3" src="http://tvax4.sinaimg.cn/default/images/default_avatar_male_180.gif"/>
      </div>
      <div class="unit">
        <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">你这坏孩子K
          
        </span>
    
  </header>
  <div class="comment-body">
    <p>为什么我的显示的是title test 。</p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">5 月，3 周前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/1583"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>
        
          <hr class="">
        
        <div class="comment-descendant-list">
          
            <div class="flex-left py-4" id="c2320">
              <div class="unit-0">
                <img class="comment-avatar mr-3" src="http://tva1.sinaimg.cn/crop.0.0.640.640.180/005X85kijw8etmdfhhtrnj30hs0htab1.jpg"/>
              </div>
              <div class="unit">
                
  <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">张克臣
          
        </span>
    
    <span class="reply-label text-small text-muted">
                                                        <i class="fa fa-share" aria-hidden="true"></i>
                                                    </span>
    <span class="nickname text-small text-muted">你这坏孩子K
        

  </header>
  <div class="comment-body">
    <p>之前的整数据库的时候，这是存过的数据，删了就显示‘暂时还没有发布的文章！’</p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">1 月前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/2320"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>

              </div>
            </div>
            
          
        </div>
      </div>
    </div>
    
      <hr class="m-0">
    
  
    <div class="flex-left py-4" id="c1548">
      <div class="unit-0">
        <img class="comment-avatar mr-3" src="https://avatars0.githubusercontent.com/u/20089093?v=4"/>
      </div>
      <div class="unit">
        <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">edsszw
          
        </span>
    
  </header>
  <div class="comment-body">
    <p>有个问题，如果你是在css里面引入了字体，北京图片，那么要怎么配置路径？一个个去改吗？</p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">6 月，1 周前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/1548"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>
        
        <div class="comment-descendant-list">
          
        </div>
      </div>
    </div>
    
      <hr class="m-0">
    
  
    <div class="flex-left py-4" id="c1523">
      <div class="unit-0">
        <img class="comment-avatar mr-3" src="https://avatars3.githubusercontent.com/u/28781415?v=4"/>
      </div>
      <div class="unit">
        <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">chenchong6
          
        </span>
    
  </header>
  <div class="comment-body">
    <p><font><font><font><font>大佬，关于静态文件夹的路径放置，是否放在项目文件下，放在app下也可以，别的应用路径也要去这个app下寻找css，js文件。还有为什么我</font></font><font><font>{％load staticfiles ％}会在页面顶部显示，element里面css，js也没用有效引入。。</font></font></font></font></p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">6 月，1 周前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/1523"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>
        
          <hr class="">
        
        <div class="comment-descendant-list">
          
            <div class="flex-left py-4" id="c1524">
              <div class="unit-0">
                <img class="comment-avatar mr-3" src="https://avatars3.githubusercontent.com/u/28781415?v=4"/>
              </div>
              <div class="unit">
                
  <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">chenchong6
          
        </span>
    
    <span class="reply-label text-small text-muted">
                                                        <i class="fa fa-share" aria-hidden="true"></i>
                                                    </span>
    <span class="nickname text-small text-muted">chenchong6
        

  </header>
  <div class="comment-body">
    <p><font><font><font><font><font><font><font><font><font><font>解决了可能是版本问题，用的是</font></font><font><font>{％load static from staticfiles％}</font></font>&nbsp;&nbsp;&nbsp;</font></font></font></font></font></font></font></font></p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">6 月，1 周前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/1524"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>

              </div>
            </div>
            
          
        </div>
      </div>
    </div>
    
      <hr class="m-0">
    
  
    <div class="flex-left py-4" id="c1487">
      <div class="unit-0">
        <img class="comment-avatar mr-3" src="http://tva3.sinaimg.cn/crop.0.0.996.996.180/006fZEd4jw8f9fa5jbkoej30ro0rowgq.jpg"/>
      </div>
      <div class="unit">
        <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">彩色的小丑
          
        </span>
    
  </header>
  <div class="comment-body">
    <p>按照博主的教程做，代码一样的，目录也是，但是刷新index.html时，还是之前的混乱样式</p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">6 月，2 周前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/1487"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>
        
          <hr class="">
        
        <div class="comment-descendant-list">
          
            <div class="flex-left py-4" id="c1689">
              <div class="unit-0">
                <img class="comment-avatar mr-3" src="https://avatars0.githubusercontent.com/u/27657015?v=4"/>
              </div>
              <div class="unit">
                
  <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">Malone1996
          
        </span>
    
    <span class="reply-label text-small text-muted">
                                                        <i class="fa fa-share" aria-hidden="true"></i>
                                                    </span>
    <span class="nickname text-small text-muted">彩色的小丑
        

  </header>
  <div class="comment-body">
    <p>我开始也是，后来发现是view.py中的index.html设置的路径不对</p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">5 月，1 周前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/1689"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>

              </div>
            </div>
            
          
        </div>
      </div>
    </div>
    
      <hr class="m-0">
    
  
    <div class="flex-left py-4" id="c1486">
      <div class="unit-0">
        <img class="comment-avatar mr-3" src="http://tva2.sinaimg.cn/crop.0.0.512.512.180/a4caec8fjw8eqpgvtnxkmj20e80e83z9.jpg"/>
      </div>
      <div class="unit">
        <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">-冯龙
          
        </span>
    
  </header>
  <div class="comment-body">
    <p style="">博主 为什么我在&nbsp;post_list =  Post.objects.all().order_by('-created_time') 这里 编译器提示我 Post 没有 objects 这个对象</p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">6 月，2 周前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/1486"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>
        
          <hr class="">
        
        <div class="comment-descendant-list">
          
            <div class="flex-left py-4" id="c1503">
              <div class="unit-0">
                <img class="comment-avatar mr-3" src="https://avatars2.githubusercontent.com/u/13174219?v=4"/>
              </div>
              <div class="unit">
                
  <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">追梦人物
          
            <span class="master">[博主]</span>
          
        </span>
    
    <span class="reply-label text-small text-muted">
                                                        <i class="fa fa-share" aria-hidden="true"></i>
                                                    </span>
    <span class="nickname text-small text-muted">-冯龙
        

  </header>
  <div class="comment-body">
    <p>你确定 Post 继承了 models.Model 么?</p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">6 月，2 周前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/1503"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>

              </div>
            </div>
            
              <hr class="m-0">
            
          
            <div class="flex-left py-4" id="c1511">
              <div class="unit-0">
                <img class="comment-avatar mr-3" src="http://tva2.sinaimg.cn/crop.0.0.512.512.180/a4caec8fjw8eqpgvtnxkmj20e80e83z9.jpg"/>
              </div>
              <div class="unit">
                
  <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">-冯龙
          
        </span>
    
    <span class="reply-label text-small text-muted">
                                                        <i class="fa fa-share" aria-hidden="true"></i>
                                                    </span>
    <span class="nickname text-small text-muted">追梦人物
        
            <span class="master">[博主]</span>
        

  </header>
  <div class="comment-body">
    <p style="">class Post(models.Model):&nbsp; &nbsp;</p><p style="">我应该是继承了，请问现在应该怎么办呢，博主</p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">6 月，2 周前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/1511"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>

              </div>
            </div>
            
              <hr class="m-0">
            
          
            <div class="flex-left py-4" id="c1513">
              <div class="unit-0">
                <img class="comment-avatar mr-3" src="https://avatars2.githubusercontent.com/u/13174219?v=4"/>
              </div>
              <div class="unit">
                
  <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">追梦人物
          
            <span class="master">[博主]</span>
          
        </span>
    
    <span class="reply-label text-small text-muted">
                                                        <i class="fa fa-share" aria-hidden="true"></i>
                                                    </span>
    <span class="nickname text-small text-muted">-冯龙
        

  </header>
  <div class="comment-body">
    <p>只能猜测你是不是导入&nbsp;Post 出了问题，要确定你这里引用的 Post 就是你定义的 Post 模型。</p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">6 月，2 周前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/1513"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>

              </div>
            </div>
            
              <hr class="m-0">
            
          
            <div class="flex-left py-4" id="c1520">
              <div class="unit-0">
                <img class="comment-avatar mr-3" src="http://tva2.sinaimg.cn/crop.0.0.512.512.180/a4caec8fjw8eqpgvtnxkmj20e80e83z9.jpg"/>
              </div>
              <div class="unit">
                
  <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">-冯龙
          
        </span>
    
    <span class="reply-label text-small text-muted">
                                                        <i class="fa fa-share" aria-hidden="true"></i>
                                                    </span>
    <span class="nickname text-small text-muted">追梦人物
        
            <span class="master">[博主]</span>
        

  </header>
  <div class="comment-body">
    <p style="">可是我只有这一个Post ，这样的话 应该就是我定义的Post的吧<br><br></p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">6 月，2 周前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/1520"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>

              </div>
            </div>
            
              <hr class="m-0">
            
          
            <div class="flex-left py-4" id="c1521">
              <div class="unit-0">
                <img class="comment-avatar mr-3" src="http://tva2.sinaimg.cn/crop.0.0.512.512.180/a4caec8fjw8eqpgvtnxkmj20e80e83z9.jpg"/>
              </div>
              <div class="unit">
                
  <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">-冯龙
          
        </span>
    
    <span class="reply-label text-small text-muted">
                                                        <i class="fa fa-share" aria-hidden="true"></i>
                                                    </span>
    <span class="nickname text-small text-muted">追梦人物
        
            <span class="master">[博主]</span>
        

  </header>
  <div class="comment-body">
    <p style="">blog下的views的代码&nbsp;</p><p style="">from django.shortcuts import render&nbsp;</p><p style="">from .models import Post</p><p style="">from django.http import HttpResponse</p><p style="">def index(request):</p><p style="">&nbsp;post_list = Post.objects.all().order_by('-created_time')    return render(request, 'blog/index.html', context={'post_list': post_list})</p><p style="">请问有什么问题吗&nbsp;</p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">6 月，2 周前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/1521"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>

              </div>
            </div>
            
              <hr class="m-0">
            
          
            <div class="flex-left py-4" id="c1535">
              <div class="unit-0">
                <img class="comment-avatar mr-3" src="https://avatars3.githubusercontent.com/u/20414785?v=4"/>
              </div>
              <div class="unit">
                
  <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">Frozon Horizon
          
        </span>
    
    <span class="reply-label text-small text-muted">
                                                        <i class="fa fa-share" aria-hidden="true"></i>
                                                    </span>
    <span class="nickname text-small text-muted">-冯龙
        

  </header>
  <div class="comment-body">
    <p>在 models.py 中 Post 类中 加一句&nbsp;objects = models.Manager()<br></p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">6 月，1 周前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/1535"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>

              </div>
            </div>
            
              <hr class="m-0">
            
          
            <div class="flex-left py-4" id="c1540">
              <div class="unit-0">
                <img class="comment-avatar mr-3" src="http://tva2.sinaimg.cn/crop.0.0.512.512.180/a4caec8fjw8eqpgvtnxkmj20e80e83z9.jpg"/>
              </div>
              <div class="unit">
                
  <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">-冯龙
          
        </span>
    
    <span class="reply-label text-small text-muted">
                                                        <i class="fa fa-share" aria-hidden="true"></i>
                                                    </span>
    <span class="nickname text-small text-muted">Frozon Horizon
        

  </header>
  <div class="comment-body">
    <p style="">哇，真的可以了，请问为什么别人的可以，我的就需要这样一个语句呢</p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">6 月，1 周前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/1540"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>

              </div>
            </div>
            
          
        </div>
      </div>
    </div>
    
      <hr class="m-0">
    
  
    <div class="flex-left py-4" id="c1459">
      <div class="unit-0">
        <img class="comment-avatar mr-3" src="http://tvax1.sinaimg.cn/default/images/default_avatar_male_180.gif"/>
      </div>
      <div class="unit">
        <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">用户5667966604
          
        </span>
    
  </header>
  <div class="comment-body">
    <p>解决了,自己犯傻了,</p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">6 月，3 周前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/1459"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>
        
        <div class="comment-descendant-list">
          
        </div>
      </div>
    </div>
    
      <hr class="m-0">
    
  
    <div class="flex-left py-4" id="c1458">
      <div class="unit-0">
        <img class="comment-avatar mr-3" src="http://tvax1.sinaimg.cn/default/images/default_avatar_male_180.gif"/>
      </div>
      <div class="unit">
        <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">用户5667966604
          
        </span>
    
  </header>
  <div class="comment-body">
    <p>博主为啥用你的index.html文件的代码,输出是空白</p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">6 月，3 周前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/1458"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>
        
          <hr class="">
        
        <div class="comment-descendant-list">
          
            <div class="flex-left py-4" id="c1477">
              <div class="unit-0">
                <img class="comment-avatar mr-3" src="https://avatars0.githubusercontent.com/u/32117540?v=4"/>
              </div>
              <div class="unit">
                
  <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">lzj24
          
        </span>
    
    <span class="reply-label text-small text-muted">
                                                        <i class="fa fa-share" aria-hidden="true"></i>
                                                    </span>
    <span class="nickname text-small text-muted">用户5667966604
        

  </header>
  <div class="comment-body">
    <p style="">我也是空白，你是怎么解决的<br></p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">6 月，2 周前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/1477"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>

              </div>
            </div>
            
          
        </div>
      </div>
    </div>
    
      <hr class="m-0">
    
  
    <div class="flex-left py-4" id="c1420">
      <div class="unit-0">
        <img class="comment-avatar mr-3" src="http://tva2.sinaimg.cn/crop.0.0.720.720.180/005tp6XQjw8em4geiblpgj30k00k0di8.jpg"/>
      </div>
      <div class="unit">
        <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">小王思雨
          
        </span>
    
  </header>
  <div class="comment-body">
    <p><img alt="Image" width="44.4688" height="25"><br></p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">6 月，3 周前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/1420"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>
        
        <div class="comment-descendant-list">
          
        </div>
      </div>
    </div>
    
      <hr class="m-0">
    
  
    <div class="flex-left py-4" id="c1393">
      <div class="unit-0">
        <img class="comment-avatar mr-3" src="http://tva2.sinaimg.cn/crop.0.0.720.720.180/005tp6XQjw8em4geiblpgj30k00k0di8.jpg"/>
      </div>
      <div class="unit">
        <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">小王思雨
          
        </span>
    
  </header>
  <div class="comment-body">
    <p>博主，下面这个问题特别困惑，求解答？</p><p>Cannot resolve keyword 'create_time' into field. Choices are: author, author_id, body, category, category_id, created_time, excerpt, id, modified_time, tags, title<br></p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">6 月，4 周前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/1393"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>
        
          <hr class="">
        
        <div class="comment-descendant-list">
          
            <div class="flex-left py-4" id="c1399">
              <div class="unit-0">
                <img class="comment-avatar mr-3" src="https://avatars2.githubusercontent.com/u/13174219?v=4"/>
              </div>
              <div class="unit">
                
  <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">追梦人物
          
            <span class="master">[博主]</span>
          
        </span>
    
    <span class="reply-label text-small text-muted">
                                                        <i class="fa fa-share" aria-hidden="true"></i>
                                                    </span>
    <span class="nickname text-small text-muted">小王思雨
        

  </header>
  <div class="comment-body">
    <p>仅有一个异常信息很难定位问题所在，需要相关代码。</p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">6 月，3 周前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/1399"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>

              </div>
            </div>
            
              <hr class="m-0">
            
          
            <div class="flex-left py-4" id="c1567">
              <div class="unit-0">
                <img class="comment-avatar mr-3" src="http://tvax3.sinaimg.cn/crop.72.0.167.167.180/0060N6Yoly8fdkd1ki6naj308e04nglm.jpg"/>
              </div>
              <div class="unit">
                
  <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">Tove_cv
          
        </span>
    
    <span class="reply-label text-small text-muted">
                                                        <i class="fa fa-share" aria-hidden="true"></i>
                                                    </span>
    <span class="nickname text-small text-muted">小王思雨
        

  </header>
  <div class="comment-body">
    <pre><code>在 views.py 中，post_list = Post.objects.all().order_by('-created_time') 是 created_time 不是 create_time ， 少了一个字母 d 。<br /></code></pre>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">6 月前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/1567"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>

              </div>
            </div>
            
              <hr class="m-0">
            
          
            <div class="flex-left py-4" id="c2012">
              <div class="unit-0">
                <img class="comment-avatar mr-3" src="https://avatars0.githubusercontent.com/u/33747115?v=4"/>
              </div>
              <div class="unit">
                
  <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">mengfan1018
          
        </span>
    
    <span class="reply-label text-small text-muted">
                                                        <i class="fa fa-share" aria-hidden="true"></i>
                                                    </span>
    <span class="nickname text-small text-muted">Tove_cv
        

  </header>
  <div class="comment-body">
    <p>这个问题下面还有好多内容，在代码中标记的是{% for post in post_list %}，不知道怎么修改，windows没问题，Mac就会出现这个问题</p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">3 月，3 周前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/2012"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>

              </div>
            </div>
            
              <hr class="m-0">
            
          
            <div class="flex-left py-4" id="c2207">
              <div class="unit-0">
                <img class="comment-avatar mr-3" src="http://tva2.sinaimg.cn/crop.0.0.750.750.180/a6c237eajw8f8e0hepipfj20ku0ku3yq.jpg"/>
              </div>
              <div class="unit">
                
  <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">MarioBai
          
        </span>
    
    <span class="reply-label text-small text-muted">
                                                        <i class="fa fa-share" aria-hidden="true"></i>
                                                    </span>
    <span class="nickname text-small text-muted">追梦人物
        
            <span class="master">[博主]</span>
        

  </header>
  <div class="comment-body">
    <p>你好的，我也出现同样的问题了，请问这个是什么情况啊？</p><p>FieldError at /blog/Cannot resolve keyword 'created_time' into field. Choices are: author, author_id, body, category, category_id, create_time, excerpt, id, modified_time, tags, titleRequest Method:GETRequest URL:<a href="http://127.0.0.1:8000/blog/Django" rel="nofollow">http://127.0.0.1:8000/blog/Django</a> Version:1.11Exception Type:FieldErrorException Value:Cannot resolve keyword 'created_time' into field. Choices are: author, author_id, body, category, category_id, create_time, excerpt, id, modified_time, tags, titleException Location:/Users/bai/anaconda3/lib/python3.6/site-packages/django/db/models/sql/query.py in names_to_path, line 1362Python Executable:/Users/bai/anaconda3/bin/pythonPython Version:3.6.0Python Path:['/Users/bai/pyproject/pdjango/myblogs', '/Users/bai/anaconda3/lib/python36.zip', '/Users/bai/anaconda3/lib/python3.6', '/Users/bai/anaconda3/lib/python3.6/lib-dynload', '/Users/bai/anaconda3/lib/python3.6/site-packages', '/Users/bai/anaconda3/lib/python3.6/site-packages/Sphinx-1.5.1-py3.6.egg', '/Users/bai/anaconda3/lib/python3.6/site-packages/aeosa', '/Users/bai/anaconda3/lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg']Server time:星期五, 26 一月 2018 15:49:09 +0800<br><br></p><p><br></p><p>我不知道发生了什么错误，我是按照您的代码来着的。</p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">2 月，1 周前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/2207"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>

              </div>
            </div>
            
              <hr class="m-0">
            
          
            <div class="flex-left py-4" id="c2347">
              <div class="unit-0">
                <img class="comment-avatar mr-3" src="http://tvax3.sinaimg.cn/crop.0.0.736.736.180/96e0181bly8fp2avxvxbej20kg0kg75e.jpg"/>
              </div>
              <div class="unit">
                
  <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">Renewingwcc
          
        </span>
    
    <span class="reply-label text-small text-muted">
                                                        <i class="fa fa-share" aria-hidden="true"></i>
                                                    </span>
    <span class="nickname text-small text-muted">小王思雨
        

  </header>
  <div class="comment-body">
    <p>因为post没有create_time这个属性，要改成created_time<br><br></p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">3 周，5 日前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/2347"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>

              </div>
            </div>
            
          
        </div>
      </div>
    </div>
    
      <hr class="m-0">
    
  
    <div class="flex-left py-4" id="c1339">
      <div class="unit-0">
        <img class="comment-avatar mr-3" src="https://avatars3.githubusercontent.com/u/21243795?v=4"/>
      </div>
      <div class="unit">
        <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">hstk
          
        </span>
    
  </header>
  <div class="comment-body">
    <p>为什么当我把 DEBUG设为true的时候页面样式是正确的，变成false的时候页面样式就乱了，终端提示说，GET 不到css和js文件了？</p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">7 月前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/1339"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>
        
          <hr class="">
        
        <div class="comment-descendant-list">
          
            <div class="flex-left py-4" id="c1341">
              <div class="unit-0">
                <img class="comment-avatar mr-3" src="https://avatars2.githubusercontent.com/u/13174219?v=4"/>
              </div>
              <div class="unit">
                
  <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">追梦人物
          
            <span class="master">[博主]</span>
          
        </span>
    
    <span class="reply-label text-small text-muted">
                                                        <i class="fa fa-share" aria-hidden="true"></i>
                                                    </span>
    <span class="nickname text-small text-muted">hstk
        

  </header>
  <div class="comment-body">
    <p>开发服务器在&nbsp;DEBUG设为true的时候无法处理静态文件。</p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">7 月前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/1341"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>

              </div>
            </div>
            
              <hr class="m-0">
            
          
            <div class="flex-left py-4" id="c1531">
              <div class="unit-0">
                <img class="comment-avatar mr-3" src="https://avatars3.githubusercontent.com/u/8031980?v=4"/>
              </div>
              <div class="unit">
                
  <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">Shaoze LUO
          
        </span>
    
    <span class="reply-label text-small text-muted">
                                                        <i class="fa fa-share" aria-hidden="true"></i>
                                                    </span>
    <span class="nickname text-small text-muted">追梦人物
        
            <span class="master">[博主]</span>
        

  </header>
  <div class="comment-body">
    <p>那么请问怎样才能在DEBUG为False的情况下GET到静态文件？</p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">6 月，1 周前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/1531"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>

              </div>
            </div>
            
              <hr class="m-0">
            
          
            <div class="flex-left py-4" id="c1538">
              <div class="unit-0">
                <img class="comment-avatar mr-3" src="https://avatars2.githubusercontent.com/u/13174219?v=4"/>
              </div>
              <div class="unit">
                
  <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">追梦人物
          
            <span class="master">[博主]</span>
          
        </span>
    
    <span class="reply-label text-small text-muted">
                                                        <i class="fa fa-share" aria-hidden="true"></i>
                                                    </span>
    <span class="nickname text-small text-muted">Shaoze LUO
        

  </header>
  <div class="comment-body">
    <p>可以使用 nginx 处理静态文件，具体请百度或者查看 nginx 的文档</p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">6 月，1 周前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/1538"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>

              </div>
            </div>
            
              <hr class="m-0">
            
          
            <div class="flex-left py-4" id="c1543">
              <div class="unit-0">
                <img class="comment-avatar mr-3" src="https://avatars3.githubusercontent.com/u/8031980?v=4"/>
              </div>
              <div class="unit">
                
  <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">Shaoze LUO
          
        </span>
    
    <span class="reply-label text-small text-muted">
                                                        <i class="fa fa-share" aria-hidden="true"></i>
                                                    </span>
    <span class="nickname text-small text-muted">追梦人物
        
            <span class="master">[博主]</span>
        

  </header>
  <div class="comment-body">
    <p>谢谢！已经搞定了！</p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">6 月，1 周前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/1543"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>

              </div>
            </div>
            
          
        </div>
      </div>
    </div>
    
      <hr class="m-0">
    
  
    <div class="flex-left py-4" id="c1330">
      <div class="unit-0">
        <img class="comment-avatar mr-3" src="http://tva3.sinaimg.cn/crop.0.0.720.720.180/a4243d2fjw8es04mw3lbcj20k00k0mxu.jpg"/>
      </div>
      <div class="unit">
        <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">chsword-陳
          
        </span>
    
  </header>
  <div class="comment-body">
    <p style="">博主，你好，请问下，我在后台添加了文章，结果还是显示“暂时还没发布文章！”下面是我的代码：</p><p style="">&lt;main class="col-md-8"&gt;{% for post in post_list %}    &lt;article class="post post-{{ post.pk }}"&gt;        &lt;header class="entry-header"&gt;            &lt;h1 class="entry-title"&gt;                &lt;a href="single.html"&gt;{{ post.title }}&lt;/a&gt;            &lt;/h1&gt;            &lt;div class="entry-meta"&gt;                &lt;span class="post-category"&gt;&lt;a href="#"&gt;{{ post.category.name }}&lt;/a&gt;&lt;/span&gt;                &lt;span class="post-date"&gt;&lt;a href="#"&gt;&lt;time class="entry-date" datetime="{{ post.created_time }}"&gt;{{ post.creaed_time }}&lt;/time&gt;&lt;/a&gt;&lt;/span&gt;                &lt;span class="post-author"&gt;&lt;a href="#"&gt;{{ post.author }}&lt;/a&gt;&lt;/span&gt;                &lt;span class="comments-link"&gt;&lt;a href="#"&gt;4 评论&lt;/a&gt;&lt;/span&gt;                &lt;span class="views-count"&gt;&lt;a href="#"&gt;588 阅读&lt;/a&gt;&lt;/span&gt;            &lt;/div&gt;        &lt;/header&gt;        &lt;div class="entry-content clearfix"&gt;            &lt;p&gt;{{ post.excerpt }}&lt;/p&gt;            &lt;div class="read-more cl-effect-14"&gt;                &lt;a href="#" class="more-link"&gt;继续阅读 &lt;span class="meta-nav"&gt;→&lt;/span&gt;&lt;/a&gt;            &lt;/div&gt;        &lt;/div&gt;    &lt;/article&gt;{% empty %}    &lt;div class="no-post"&gt;暂时还没发布文章！&lt;/div&gt;{% endfor %}<br></p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">7 月前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/1330"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>
        
          <hr class="">
        
        <div class="comment-descendant-list">
          
            <div class="flex-left py-4" id="c1332">
              <div class="unit-0">
                <img class="comment-avatar mr-3" src="https://avatars2.githubusercontent.com/u/13174219?v=4"/>
              </div>
              <div class="unit">
                
  <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">追梦人物
          
            <span class="master">[博主]</span>
          
        </span>
    
    <span class="reply-label text-small text-muted">
                                                        <i class="fa fa-share" aria-hidden="true"></i>
                                                    </span>
    <span class="nickname text-small text-muted">chsword-陳
        

  </header>
  <div class="comment-body">
    <p>post_list 已从视图函数中传递给了模板？并且模板变量设置为&nbsp;post_list<br></p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">7 月前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/1332"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>

              </div>
            </div>
            
              <hr class="m-0">
            
          
            <div class="flex-left py-4" id="c1333">
              <div class="unit-0">
                <img class="comment-avatar mr-3" src="http://tva3.sinaimg.cn/crop.0.0.720.720.180/a4243d2fjw8es04mw3lbcj20k00k0mxu.jpg"/>
              </div>
              <div class="unit">
                
  <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">chsword-陳
          
        </span>
    
    <span class="reply-label text-small text-muted">
                                                        <i class="fa fa-share" aria-hidden="true"></i>
                                                    </span>
    <span class="nickname text-small text-muted">追梦人物
        
            <span class="master">[博主]</span>
        

  </header>
  <div class="comment-body">
    <p style="">搞定了，就是忘了添加视图了，太粗心了⊙﹏⊙‖∣，谢谢博主<br></p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">7 月前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/1333"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>

              </div>
            </div>
            
              <hr class="m-0">
            
          
            <div class="flex-left py-4" id="c1343">
              <div class="unit-0">
                <img class="comment-avatar mr-3" src="https://avatars1.githubusercontent.com/u/16384951?v=4"/>
              </div>
              <div class="unit">
                
  <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">heidanchaofanhei
          
        </span>
    
    <span class="reply-label text-small text-muted">
                                                        <i class="fa fa-share" aria-hidden="true"></i>
                                                    </span>
    <span class="nickname text-small text-muted">chsword-陳
        

  </header>
  <div class="comment-body">
    <p>我刚才跟你一样的问题，然后重新文章，发现漏了blog/views.py的修改，本来想跟你说一下，看到大神已经给你回复了，不得不说大神回复真及时啊</p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">7 月前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/1343"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>

              </div>
            </div>
            
              <hr class="m-0">
            
          
            <div class="flex-left py-4" id="c1352">
              <div class="unit-0">
                <img class="comment-avatar mr-3" src="http://tva3.sinaimg.cn/crop.0.0.720.720.180/a4243d2fjw8es04mw3lbcj20k00k0mxu.jpg"/>
              </div>
              <div class="unit">
                
  <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">chsword-陳
          
        </span>
    
    <span class="reply-label text-small text-muted">
                                                        <i class="fa fa-share" aria-hidden="true"></i>
                                                    </span>
    <span class="nickname text-small text-muted">heidanchaofanhei
        

  </header>
  <div class="comment-body">
    <p style="">当时没仔细看，漏看了那段代码了<br></p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">7 月前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/1352"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>

              </div>
            </div>
            
          
        </div>
      </div>
    </div>
    
      <hr class="m-0">
    
  
    <div class="flex-left py-4" id="c1316">
      <div class="unit-0">
        <img class="comment-avatar mr-3" src="https://avatars3.githubusercontent.com/u/24587895?v=4"/>
      </div>
      <div class="unit">
        <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">Rayutn
          
        </span>
    
  </header>
  <div class="comment-body">
    <p>博主好，请问对&lt;article&gt;标签用{% &nbsp; for &nbsp;%}标签进行处理后运行python manage.py runserver成功启动服务后，在浏览器上运行<a href="http://127.0.0.1:8000/" rel="nofollow">http://127.0.0.1:8000/</a>会失败，之后后台会显示编码错误：</p><p>File "C:\Python3\lib\traceback.py", line 520, in _load_lines&nbsp; &nbsp; frame.line&nbsp; File "C:\Python3\lib\traceback.py", line 282, in line&nbsp; &nbsp; self._line = linecache.getline(self.filename, self.lineno).strip()&nbsp; File "C:\Python3\lib\linecache.py", line 16, in getline&nbsp; &nbsp; lines = getlines(filename, module_globals)&nbsp; File "C:\Python3\lib\linecache.py", line 47, in getlines&nbsp; &nbsp; return updatecache(filename, module_globals)&nbsp; File "C:\Python3\lib\linecache.py", line 137, in updatecache&nbsp; &nbsp; lines = fp.readlines()&nbsp; File "C:\Python3\lib\codecs.py", line 321, in decode&nbsp; &nbsp; (result, consumed) = self._buffer_decode(data, self.errors, final)UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb2 in position 272: invalid start byte<br></p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">7 月前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/1316"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>
        
          <hr class="">
        
        <div class="comment-descendant-list">
          
            <div class="flex-left py-4" id="c1317">
              <div class="unit-0">
                <img class="comment-avatar mr-3" src="https://avatars2.githubusercontent.com/u/13174219?v=4"/>
              </div>
              <div class="unit">
                
  <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">追梦人物
          
            <span class="master">[博主]</span>
          
        </span>
    
    <span class="reply-label text-small text-muted">
                                                        <i class="fa fa-share" aria-hidden="true"></i>
                                                    </span>
    <span class="nickname text-small text-muted">Rayutn
        

  </header>
  <div class="comment-body">
    <p>这个可能是你的 html 模板编码问题，尝试重新以 utf-8 编码保存，还是不行就复制里面的内容，删了重新创建一个 utf-8 编码的文件。</p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">7 月前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/1317"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>

              </div>
            </div>
            
              <hr class="m-0">
            
          
            <div class="flex-left py-4" id="c1323">
              <div class="unit-0">
                <img class="comment-avatar mr-3" src="https://avatars3.githubusercontent.com/u/24587895?v=4"/>
              </div>
              <div class="unit">
                
  <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">Rayutn
          
        </span>
    
    <span class="reply-label text-small text-muted">
                                                        <i class="fa fa-share" aria-hidden="true"></i>
                                                    </span>
    <span class="nickname text-small text-muted">追梦人物
        
            <span class="master">[博主]</span>
        

  </header>
  <div class="comment-body">
    <p>按照步骤重新将html文件重新改了一遍，编码确实是用的utf-8，但是还是没用。我觉得是因为从数据库读出内容后在传入页面的过程中出了编码的问题，而不是html文件的编码问题。实在不知道该怎么改了，求博主帮忙想想，谢谢了</p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">7 月前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/1323"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>

              </div>
            </div>
            
              <hr class="m-0">
            
          
            <div class="flex-left py-4" id="c1325">
              <div class="unit-0">
                <img class="comment-avatar mr-3" src="https://avatars2.githubusercontent.com/u/13174219?v=4"/>
              </div>
              <div class="unit">
                
  <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">追梦人物
          
            <span class="master">[博主]</span>
          
        </span>
    
    <span class="reply-label text-small text-muted">
                                                        <i class="fa fa-share" aria-hidden="true"></i>
                                                    </span>
    <span class="nickname text-small text-muted">Rayutn
        

  </header>
  <div class="comment-body">
    <p>这个问题还真没有遇到过，看看数据库的文档怎么说吧？很多人使用 sqlite，mysql 都没这个编码问题。</p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">7 月前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/1325"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>

              </div>
            </div>
            
              <hr class="m-0">
            
          
            <div class="flex-left py-4" id="c1329">
              <div class="unit-0">
                <img class="comment-avatar mr-3" src="https://avatars3.githubusercontent.com/u/24587895?v=4"/>
              </div>
              <div class="unit">
                
  <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">Rayutn
          
        </span>
    
    <span class="reply-label text-small text-muted">
                                                        <i class="fa fa-share" aria-hidden="true"></i>
                                                    </span>
    <span class="nickname text-small text-muted">追梦人物
        
            <span class="master">[博主]</span>
        

  </header>
  <div class="comment-body">
    <p>嗯 &nbsp;我自己再慢慢找解决方法。我用的也是MySQL。。。。。</p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">7 月前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/1329"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>

              </div>
            </div>
            
              <hr class="m-0">
            
          
            <div class="flex-left py-4" id="c1715">
              <div class="unit-0">
                <img class="comment-avatar mr-3" src="https://avatars3.githubusercontent.com/u/32827300?v=4"/>
              </div>
              <div class="unit">
                
  <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">fshgrym
          
        </span>
    
    <span class="reply-label text-small text-muted">
                                                        <i class="fa fa-share" aria-hidden="true"></i>
                                                    </span>
    <span class="nickname text-small text-muted">Rayutn
        

  </header>
  <div class="comment-body">
    <p>我感觉你是用pycharm,如果是，把右下角的编码gbk编码改成utf-8</p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">5 月，1 周前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/1715"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>

              </div>
            </div>
            
          
        </div>
      </div>
    </div>
    
      <hr class="m-0">
    
  
    <div class="flex-left py-4" id="c1314">
      <div class="unit-0">
        <img class="comment-avatar mr-3" src="https://avatars3.githubusercontent.com/u/24587895?v=4"/>
      </div>
      <div class="unit">
        <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">Rayutn
          
        </span>
    
  </header>
  <div class="comment-body">
    <p>修改完后python manage.py runserver 启动服务成功后在浏览器上运行<a href="http://0.0.0.0:8080/" rel="nofollow">http://0.0.0.0:8080/</a>显示网站错误。。。。</p><p>以为8080端口被占用，修改端口python manage.py runserver 0.0.0.0:8081 启动服务成功，浏览器运行还是失败。</p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">7 月前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/1314"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>
        
        <div class="comment-descendant-list">
          
        </div>
      </div>
    </div>
    
      <hr class="m-0">
    
  
    <div class="flex-left py-4" id="c1297">
      <div class="unit-0">
        <img class="comment-avatar mr-3" src="https://avatars1.githubusercontent.com/u/29867399?v=4"/>
      </div>
      <div class="unit">
        <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">bumian
          
        </span>
    
  </header>
  <div class="comment-body">
    <p>博主，没找到html里面有article这个标签啊<br><br></p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">7 月前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/1297"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>
        
          <hr class="">
        
        <div class="comment-descendant-list">
          
            <div class="flex-left py-4" id="c1298">
              <div class="unit-0">
                <img class="comment-avatar mr-3" src="https://avatars2.githubusercontent.com/u/13174219?v=4"/>
              </div>
              <div class="unit">
                
  <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">追梦人物
          
            <span class="master">[博主]</span>
          
        </span>
    
    <span class="reply-label text-small text-muted">
                                                        <i class="fa fa-share" aria-hidden="true"></i>
                                                    </span>
    <span class="nickname text-small text-muted">bumian
        

  </header>
  <div class="comment-body">
    <p>在仔细找找，最好用 ctrl+F 搜索</p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">7 月前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/1298"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>

              </div>
            </div>
            
          
        </div>
      </div>
    </div>
    
      <hr class="m-0">
    
  
    <div class="flex-left py-4" id="c1052">
      <div class="unit-0">
        <img class="comment-avatar mr-3" src="http://tva2.sinaimg.cn/crop.0.100.400.400.180/aa7e4bfejw8e7ffi6g8e1j20b40godga.jpg"/>
      </div>
      <div class="unit">
        <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">唯J王道
          
        </span>
    
  </header>
  <div class="comment-body">
    一般我把static目录写到根下面和templates同级然后再配置STATICFILES_DIRS <br />博主这样把static写在app下不配置STATICFILES_DIRS是否意味着django会自动从app下去拼接静态资源路径。如settings里只写STATIC_URL = '/static/' 拼接后路径为pace.css，实际上他就是从app的根路径开始找的
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">7 月，3 周前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/1052"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>
        
          <hr class="">
        
        <div class="comment-descendant-list">
          
            <div class="flex-left py-4" id="c1053">
              <div class="unit-0">
                <img class="comment-avatar mr-3" src="https://avatars2.githubusercontent.com/u/13174219?v=4"/>
              </div>
              <div class="unit">
                
  <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">追梦人物
          
            <span class="master">[博主]</span>
          
        </span>
    
    <span class="reply-label text-small text-muted">
                                                        <i class="fa fa-share" aria-hidden="true"></i>
                                                    </span>
    <span class="nickname text-small text-muted">唯J王道
        

  </header>
  <div class="comment-body">
    对，现在 app 下 django 会自动寻找，无需配置。否则需要配置 STATICFILES_DIRS
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">7 月，3 周前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/1053"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>

              </div>
            </div>
            
          
        </div>
      </div>
    </div>
    
      <hr class="m-0">
    
  
    <div class="flex-left py-4" id="c932">
      <div class="unit-0">
        <img class="comment-avatar mr-3" src="http://tva3.sinaimg.cn/crop.0.1.750.750.180/b6915e06jw8erwrq8wv7fj20ku0kwgmc.jpg"/>
      </div>
      <div class="unit">
        <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">米粥fly怕素色pool
          
        </span>
    
  </header>
  <div class="comment-body">
    大哥 我这渲染咋不行啊 {% for post in post_list %}一直被红色标记视图函数也没错啊
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">8 月前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/932"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>
        
          <hr class="">
        
        <div class="comment-descendant-list">
          
            <div class="flex-left py-4" id="c935">
              <div class="unit-0">
                <img class="comment-avatar mr-3" src="https://avatars2.githubusercontent.com/u/13174219?v=4"/>
              </div>
              <div class="unit">
                
  <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">追梦人物
          
            <span class="master">[博主]</span>
          
        </span>
    
    <span class="reply-label text-small text-muted">
                                                        <i class="fa fa-share" aria-hidden="true"></i>
                                                    </span>
    <span class="nickname text-small text-muted">米粥fly怕素色pool
        

  </header>
  <div class="comment-body">
    不行具体指的是什么？没有数据？
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">8 月前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/935"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>

              </div>
            </div>
            
              <hr class="m-0">
            
          
            <div class="flex-left py-4" id="c2011">
              <div class="unit-0">
                <img class="comment-avatar mr-3" src="https://avatars0.githubusercontent.com/u/33747115?v=4"/>
              </div>
              <div class="unit">
                
  <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">mengfan1018
          
        </span>
    
    <span class="reply-label text-small text-muted">
                                                        <i class="fa fa-share" aria-hidden="true"></i>
                                                    </span>
    <span class="nickname text-small text-muted">追梦人物
        
            <span class="master">[博主]</span>
        

  </header>
  <div class="comment-body">
    <p>我和他遇见的问题一样，在windows下没问题，但是一到macOS就会出现这个问题。</p><p>Cannot resolve keyword 'created_time' into field. Choices are: author, author_id, body, category, category_id, create_time, excerpt, id, modified_time, tags, title<br></p><p>标红 {% for post in post_list %}<br></p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">3 月，3 周前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/2011"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>

              </div>
            </div>
            
          
        </div>
      </div>
    </div>
    
      <hr class="m-0">
    
  
    <div class="flex-left py-4" id="c876">
      <div class="unit-0">
        <img class="comment-avatar mr-3" src="https://avatars2.githubusercontent.com/u/11514523?v=4"/>
      </div>
      <div class="unit">
        <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">jackhanzy
          
        </span>
    
  </header>
  <div class="comment-body">
    02/Aug/2017 10:48:26] "GET /static/blog/js/jquery-2.1.3.min.js HTTP/1.1" 404 1697<br />[02/Aug/2017 10:48:26] "GET pace.css HTTP/1.1" 404 1667<br />[02/Aug/2017 10:48:26] "GET bootstrap.min.css HTTP/1.1" 404 1694<br />[02/Aug/2017 10:48:26] "GET /static/blog/css/custom.css HTTP/1.1" 404 1673<br />[02/Aug/2017 10:48:26] "GET /static/blog/js/bootstrap.min.js HTTP/1.1" 404 1688<br />[02/Aug/2017 10:48:26] "GET /static/blog/js/pace.min.js HTTP/1.1" 404 1673<br />[02/Aug/2017 10:48:26] "GET /static/blog/js/modernizr.custom.js HTTP/1.1" 404 1697<br />[02/Aug/2017 10:48:26] "GET /static/blog/js/script.js HTTP/1.1" 404 1667<br /><br />还是显示乱的，怎么回事
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">8 月，1 周前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/876"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>
        
          <hr class="">
        
        <div class="comment-descendant-list">
          
            <div class="flex-left py-4" id="c887">
              <div class="unit-0">
                <img class="comment-avatar mr-3" src="https://avatars2.githubusercontent.com/u/13174219?v=4"/>
              </div>
              <div class="unit">
                
  <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">追梦人物
          
            <span class="master">[博主]</span>
          
        </span>
    
    <span class="reply-label text-small text-muted">
                                                        <i class="fa fa-share" aria-hidden="true"></i>
                                                    </span>
    <span class="nickname text-small text-muted">jackhanzy
        

  </header>
  <div class="comment-body">
    看上去像是你的 static 设置有误，严格按照教程重做一遍，注意静态文件的存放路径，如果还有问题，请把相关代码贴上来才好定问问题所在。
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">8 月前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/887"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>

              </div>
            </div>
            
              <hr class="m-0">
            
          
            <div class="flex-left py-4" id="c1228">
              <div class="unit-0">
                <img class="comment-avatar mr-3" src="http://tva3.sinaimg.cn/crop.0.199.711.711.180/6d47e4dejw8fbsc761h6nj20jz0zktap.jpg"/>
              </div>
              <div class="unit">
                
  <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">志子杰-勇士哥
          
        </span>
    
    <span class="reply-label text-small text-muted">
                                                        <i class="fa fa-share" aria-hidden="true"></i>
                                                    </span>
    <span class="nickname text-small text-muted">jackhanzy
        

  </header>
  <div class="comment-body">
    css、js、img 文件夹拷贝进blogproject/blog/static/blog这个目录<br />我之前目录整错了，跟你一样的错误。
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">7 月，1 周前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/1228"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>

              </div>
            </div>
            
          
        </div>
      </div>
    </div>
    
      <hr class="m-0">
    
  
    <div class="flex-left py-4" id="c836">
      <div class="unit-0">
        <img class="comment-avatar mr-3" src="https://avatars3.githubusercontent.com/u/29860665?v=4"/>
      </div>
      <div class="unit">
        <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">smilexnan
          
        </span>
    
  </header>
  <div class="comment-body">
    打卡打卡
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">8 月，2 周前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/836"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>
        
        <div class="comment-descendant-list">
          
        </div>
      </div>
    </div>
    
      <hr class="m-0">
    
  
    <div class="flex-left py-4" id="c782">
      <div class="unit-0">
        <img class="comment-avatar mr-3" src="http://tva3.sinaimg.cn/crop.0.0.1242.1242.180/706dfcfejw8f9eajvl0qoj20yi0yijsp.jpg"/>
      </div>
      <div class="unit">
        <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">26岁且一事无成
          
        </span>
    
  </header>
  <div class="comment-body">
    修改后还是混乱的，已经清理缓存了
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">8 月，2 周前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/782"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>
        
          <hr class="">
        
        <div class="comment-descendant-list">
          
            <div class="flex-left py-4" id="c793">
              <div class="unit-0">
                <img class="comment-avatar mr-3" src="http://tva3.sinaimg.cn/crop.0.0.1242.1242.180/706dfcfejw8f9eajvl0qoj20yi0yijsp.jpg"/>
              </div>
              <div class="unit">
                
  <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">26岁且一事无成
          
        </span>
    
    <span class="reply-label text-small text-muted">
                                                        <i class="fa fa-share" aria-hidden="true"></i>
                                                    </span>
    <span class="nickname text-small text-muted">26岁且一事无成
        

  </header>
  <div class="comment-body">
    已解决
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">8 月，2 周前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/793"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>

              </div>
            </div>
            
              <hr class="m-0">
            
          
            <div class="flex-left py-4" id="c816">
              <div class="unit-0">
                <img class="comment-avatar mr-3" src="https://avatars2.githubusercontent.com/u/20392551?v=4"/>
              </div>
              <div class="unit">
                
  <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">zhuxinxia1992
          
        </span>
    
    <span class="reply-label text-small text-muted">
                                                        <i class="fa fa-share" aria-hidden="true"></i>
                                                    </span>
    <span class="nickname text-small text-muted">26岁且一事无成
        

  </header>
  <div class="comment-body">
    您好，请问如何解决的？为什么我加了{% load staticfiles %}他的下一行<!DOCTYPE html>显示有错误，而且格式还是错乱的
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">8 月，2 周前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/816"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>

              </div>
            </div>
            
              <hr class="m-0">
            
          
            <div class="flex-left py-4" id="c1474">
              <div class="unit-0">
                <img class="comment-avatar mr-3" src="http://tva3.sinaimg.cn/crop.0.0.1080.1080.180/50dfb4ccjw8emhuihg5t0j20u00u0aby.jpg"/>
              </div>
              <div class="unit">
                
  <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">小明你哦
          
        </span>
    
    <span class="reply-label text-small text-muted">
                                                        <i class="fa fa-share" aria-hidden="true"></i>
                                                    </span>
    <span class="nickname text-small text-muted">26岁且一事无成
        

  </header>
  <div class="comment-body">
    <p>我直接复制了博主的代码，样式还是乱的，请问您是如何解决的？</p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">6 月，2 周前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/1474"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>

              </div>
            </div>
            
              <hr class="m-0">
            
          
            <div class="flex-left py-4" id="c1592">
              <div class="unit-0">
                <img class="comment-avatar mr-3" src="http://tvax2.sinaimg.cn/crop.0.0.512.512.180/8f3f44cbly8fmj5qwxadyj20e80e8mxy.jpg"/>
              </div>
              <div class="unit">
                
  <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">YoJohnDoe
          
        </span>
    
    <span class="reply-label text-small text-muted">
                                                        <i class="fa fa-share" aria-hidden="true"></i>
                                                    </span>
    <span class="nickname text-small text-muted">小明你哦
        

  </header>
  <div class="comment-body">
    <p>我最开始按照模板给出的CSS文件进行{%%}，修改也是乱的，仔细看了看，发现是其中两个css文件路径 没有带上blog/。 填上就好了。</p>
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">5 月，3 周前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/1592"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>

              </div>
            </div>
            
          
        </div>
      </div>
    </div>
    
      <hr class="m-0">
    
  
    <div class="flex-left py-4" id="c751">
      <div class="unit-0">
        <img class="comment-avatar mr-3" src="http://tva1.sinaimg.cn/crop.0.0.170.170.180/006iaCByjw8ey521uhzj6j304q04qt8h.jpg"/>
      </div>
      <div class="unit">
        <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">杨晟泽
          
        </span>
    
  </header>
  <div class="comment-body">
    Bootstrap也挺不错的，避免了很多麻烦的
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">8 月，3 周前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/751"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>
        
        <div class="comment-descendant-list">
          
        </div>
      </div>
    </div>
    
      <hr class="m-0">
    
  
    <div class="flex-left py-4" id="c695">
      <div class="unit-0">
        <img class="comment-avatar mr-3" src="http://tva3.sinaimg.cn/crop.0.1.640.640.180/6aae284bjw8f1e80tw0rgj20hs0hu75q.jpg"/>
      </div>
      <div class="unit">
        <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">美图公子
          
        </span>
    
  </header>
  <div class="comment-body">
    博主好，<article class="post post-1"><br />  ...<br /></article><br /><br />这个article是由什么定义的呢？是django还是bootstrap?
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">9 月前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/695"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>
        
          <hr class="">
        
        <div class="comment-descendant-list">
          
            <div class="flex-left py-4" id="c696">
              <div class="unit-0">
                <img class="comment-avatar mr-3" src="https://avatars2.githubusercontent.com/u/13174219?v=4"/>
              </div>
              <div class="unit">
                
  <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">追梦人物
          
            <span class="master">[博主]</span>
          
        </span>
    
    <span class="reply-label text-small text-muted">
                                                        <i class="fa fa-share" aria-hidden="true"></i>
                                                    </span>
    <span class="nickname text-small text-muted">美图公子
        

  </header>
  <div class="comment-body">
    article 是 html 定义的标签，类似于 div
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">9 月前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/696"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>

              </div>
            </div>
            
          
        </div>
      </div>
    </div>
    
      <hr class="m-0">
    
  
    <div class="flex-left py-4" id="c501">
      <div class="unit-0">
        <img class="comment-avatar mr-3" src="https://avatars3.githubusercontent.com/u/8360241?v=3"/>
      </div>
      <div class="unit">
        <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">wlz
          
        </span>
    
  </header>
  <div class="comment-body">
    {% load staticfiles %}<br /><!DOCTYPE html><br /><html><br /><head><br />    <title>Black &amp; White</title><br /><br />    <!-- meta --><br />    <meta charset="UTF-8"><br />    <meta name="viewport" content="width=device-width, initial-scale=1"><br /><br />    <!-- css --><br />    <link rel="stylesheet" href="bootstrap.min.css' %}"><br />    <link rel="stylesheet" href="pace.css' %}"><br />    <link rel="stylesheet" href="custom.css' %}">`<br />	<link rel="stylesheet" href="ionicons.min.css"><br />	<br />    <!-- js --><br />    <script src="{% static 'blog/js/jquery-2.1.3.min.js' %}"></script><br />    <script src="{% static 'blog/js/bootstrap.min.js' %}"></script><br />    <script src="{% static 'blog/js/pace.min.js' %}"></script><br />    <script src="{% static 'blog/js/modernizr.custom.js' %}"></script><br /></head><br /><br />修改后布局还说混乱的
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">9 月，3 周前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/501"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>
        
          <hr class="">
        
        <div class="comment-descendant-list">
          
            <div class="flex-left py-4" id="c502">
              <div class="unit-0">
                <img class="comment-avatar mr-3" src="https://avatars3.githubusercontent.com/u/8360241?v=3"/>
              </div>
              <div class="unit">
                
  <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">wlz
          
        </span>
    
    <span class="reply-label text-small text-muted">
                                                        <i class="fa fa-share" aria-hidden="true"></i>
                                                    </span>
    <span class="nickname text-small text-muted">wlz
        

  </header>
  <div class="comment-body">
    可以显示了，没有清缓存
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">9 月，3 周前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/502"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>

              </div>
            </div>
            
          
        </div>
      </div>
    </div>
    
      <hr class="m-0">
    
  
    <div class="flex-left py-4" id="c382">
      <div class="unit-0">
        <img class="comment-avatar mr-3" src="http://tva4.sinaimg.cn/crop.0.0.1080.1080.180/c22067c5jw8elb3ern642j20u00u00us.jpg"/>
      </div>
      <div class="unit">
        <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">稀里哗啦NZND
          
        </span>
    
  </header>
  <div class="comment-body">
    在登陆后，点击Black& White按钮，，出现<br />Page not found (404)<br />Request Method:	GET<br />Request URL:	http://127.0.0.1:8000/index.html<br />Using the URLconf defined in blogproject.urls, Django tried these URL patterns, in this order:<br />^admin/<br />^$ [name='index']<br />^post/(?P<pk>[0-9]+)/$ [name='detail']<br />The current URL, index.html, didn't match any of these.，，，<br />这是什么原因??明明已经有index.html 文件了，，为甚么get不到呢？
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">9 月，4 周前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/382"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>
        
        <div class="comment-descendant-list">
          
        </div>
      </div>
    </div>
    
      <hr class="m-0">
    
  
    <div class="flex-left py-4" id="c162">
      <div class="unit-0">
        <img class="comment-avatar mr-3" src="https://avatars1.githubusercontent.com/u/28527786?v=3"/>
      </div>
      <div class="unit">
        <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">liuchengfei
          
        </span>
    
  </header>
  <div class="comment-body">
    样式一直是原先混乱那种
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">10 月，2 周前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/162"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>
        
          <hr class="">
        
        <div class="comment-descendant-list">
          
            <div class="flex-left py-4" id="c163">
              <div class="unit-0">
                <img class="comment-avatar mr-3" src="https://avatars2.githubusercontent.com/u/13174219?v=4"/>
              </div>
              <div class="unit">
                
  <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">追梦人物
          
            <span class="master">[博主]</span>
          
        </span>
    
    <span class="reply-label text-small text-muted">
                                                        <i class="fa fa-share" aria-hidden="true"></i>
                                                    </span>
    <span class="nickname text-small text-muted">liuchengfei
        

  </header>
  <div class="comment-body">
    Static 引入静态文件。
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">10 月，2 周前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/163"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>

              </div>
            </div>
            
          
        </div>
      </div>
    </div>
    
      <hr class="m-0">
    
  
    <div class="flex-left py-4" id="c85">
      <div class="unit-0">
        <img class="comment-avatar mr-3" src="https://avatars1.githubusercontent.com/u/15381809?v=3"/>
      </div>
      <div class="unit">
        <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">gleesu
          
        </span>
    
  </header>
  <div class="comment-body">
    博主，你好<br />想请教一下<br />私下按教程更改后，好像并没有正确使用static<br />后台添加博文后，也无法在首页显示，一直显示“暂时还没有发布的文章！”<br />请问您能看出来，问题出在哪儿吗？<br />==对照了几遍，觉得没设置错<br />麻烦啦！<br /><br />以下是输出的log：<br />[13/May/2017 16:42:19] "GET / HTTP/1.1" 200 5026<br />Not Found: /css/bootstrap.min.css<br />[13/May/2017 16:42:19] "GET /css/bootstrap.min.css HTTP/1.1" 404 2134<br />Not Found: /css/pace.css<br />[13/May/2017 16:42:19] "GET /css/pace.css HTTP/1.1" 404 2107<br />Not Found: /css/custom.css<br />[13/May/2017 16:42:19] "GET /css/custom.css HTTP/1.1" 404 2113<br />Not Found: /js/bootstrap.min.js<br />Not Found: /js/jquery-2.1.3.min.js<br />[13/May/2017 16:42:19] "GET /js/jquery-2.1.3.min.js HTTP/1.1" 404 2137<br />Not Found: /js/pace.min.js<br />Not Found: /js/modernizr.custom.js<br />[13/May/2017 16:42:19] "GET /js/bootstrap.min.js HTTP/1.1" 404 2128<br />[13/May/2017 16:42:19] "GET /js/pace.min.js HTTP/1.1" 404 2113<br />[13/May/2017 16:42:19] "GET /static/blog/js/pace/min.js HTTP/1.1" 404 1670<br />Not Found: /js/script.js<br />[13/May/2017 16:42:19] "GET /js/modernizr.custom.js HTTP/1.1" 404 2137<br />[13/May/2017 16:42:19] "GET /js/script.js HTTP/1.1" 404 2107<br />[13/May/2017 16:42:19] "GET /static/blog/js/pace/min.js HTTP/1.1" 404 1670<br />Not Found: /js/script.js<br />[13/May/2017 16:42:20] "GET /js/script.js HTTP/1.1" 404 2107
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">10 月，4 周前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/85"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>
        
          <hr class="">
        
        <div class="comment-descendant-list">
          
            <div class="flex-left py-4" id="c86">
              <div class="unit-0">
                <img class="comment-avatar mr-3" src="https://avatars1.githubusercontent.com/u/15381809?v=3"/>
              </div>
              <div class="unit">
                
  <div class="comment-main">
  <header class="comment-user">
        <span class="text-small text-muted nickname">gleesu
          
        </span>
    
    <span class="reply-label text-small text-muted">
                                                        <i class="fa fa-share" aria-hidden="true"></i>
                                                    </span>
    <span class="nickname text-small text-muted">gleesu
        

  </header>
  <div class="comment-body">
    好像知道哪儿错了，我在html用#当注释了-- sorry，我去试试看
  </div>
  <footer class="comment-footer flex-left">
    <ul class="unit list-inline dot-divider">
      <li class="list-inline-item">
        <time class="text-small text-muted">10 月，4 周前</time>
      </li>
      <li class="list-inline-item">
        <a href="/comments/reply/86"
           class="reply-btn text-small text-muted">回复</a>
      </li>
    </ul>
  </footer>
</div>

              </div>
            </div>
            
          
        </div>
      </div>
    </div>
    
  
</div>
  </section>
</div>
  </div>

    </div>
  </div>
</section>
<footer class="bg-white py-5 mt-5 text-small text-muted">
  <div class="flex-center">
    <div>&copy; 2017 追梦人物的博客</div>
  </div>
  
  
  
</footer>
<script>
    $('[data-menu]').menu();

    var InterValObj; //timer变量，控制时间
    var curCount = 120;//当前剩余秒数

    $('#js-send').on('click', function (event) {
        var $this = $(this);
        var $targetURL = $this.attr('data-target');
        $.post(
            $targetURL,
            {email: $('#id_email').val()},
            function (data) {
                if (data.ok) {
                    $this.attr("disabled", "true");
                    $this.text("重新发送验证码" + "(" + curCount + ")");
                    InterValObj = window.setInterval(SetRemainTime, 1000); //启动计时器，1秒执行一次
                    $('.message')
                        .find('span')
                        .text(data.msg)
                } else {
                    $('.message').find('span').text(data.msg)
                }
            }
        );
        return false;
    });

    //timer处理函数
    function SetRemainTime() {
        if (curCount === 0) {
            window.clearInterval(InterValObj);//停止计时器
            $('#js-send').removeAttr("disabled");//启用按钮
            $('#js-send').text("重新发送验证码");
        }
        else {
            curCount--;
            $('#js-send').text("重新发送验证码" + "(" + curCount + ")");
        }
    }

    $('#js-submit').on('click', function (event) {
        var $this = $(this);
        var $form = $('.email-binding-form');
        var $targetURL = $form.attr('action');
        console.log($targetURL);

        $.post(
            $targetURL,
            {
                email: $('#id_email').val(),
                verification_code: $('#id_verification_code').val()
            },
            function (data) {
                if (data.ok) {
                    location.reload();
                } else {
                    $('.message')
                        .find('span')
                        .text(data.msg)
                }
            }
        );
        return false;
    });


    var editor = new Simditor({
        textarea: $('#id_comment'),
        placeholder: "提出你的见解...",
        toolbarFloat: false,
        cleanPaste: true,
        toolbar: [
            'bold',
            'italic',
            'underline',
            'strikethrough',
            'color',
            'ol',
            'ul',
            'blockquote',
            'code',
            'table',
            'link',
            'image',
            'hr'
        ]
    });
</script>


</body>
</html>